Commit 8ef1bf6d authored by James Simmons's avatar James Simmons

Merge http://fbdev.bkbits.net/fbdev-2.5

into heisenberg.transvirtual.com:/tmp/fbdev-2.5
parents af5c826c a321a55f
...@@ -15,6 +15,10 @@ C-procfs-example = procfs_example.sgml ...@@ -15,6 +15,10 @@ C-procfs-example = procfs_example.sgml
$(TOPDIR)/scripts/docgen $(TOPDIR)/scripts/gen-all-syms \ $(TOPDIR)/scripts/docgen $(TOPDIR)/scripts/gen-all-syms \
$(TOPDIR)/scripts/kernel-doc $(TOPDIR)/scripts/docproc: doc-progs ; $(TOPDIR)/scripts/kernel-doc $(TOPDIR)/scripts/docproc: doc-progs ;
dochelp:
@echo ' Linux kernel internal documentation in different formats:'
@echo ' sgmldocs (SGML), psdocs (Postscript), pdfdocs (PDF), htmldocs (HTML)'
.PHONY: doc-progs .PHONY: doc-progs
doc-progs: doc-progs:
@$(MAKE) -C $(TOPDIR)/scripts doc-progs @$(MAKE) -C $(TOPDIR)/scripts doc-progs
...@@ -116,6 +120,7 @@ APISOURCES := $(TOPDIR)/drivers/media/video/videodev.c \ ...@@ -116,6 +120,7 @@ APISOURCES := $(TOPDIR)/drivers/media/video/videodev.c \
$(TOPDIR)/drivers/usb/core/urb.c \ $(TOPDIR)/drivers/usb/core/urb.c \
$(TOPDIR)/drivers/usb/core/message.c \ $(TOPDIR)/drivers/usb/core/message.c \
$(TOPDIR)/drivers/usb/core/config.c \ $(TOPDIR)/drivers/usb/core/config.c \
$(TOPDIR)/drivers/usb/core/file.c \
$(TOPDIR)/drivers/usb/core/usb.c \ $(TOPDIR)/drivers/usb/core/usb.c \
$(TOPDIR)/drivers/video/fbmem.c \ $(TOPDIR)/drivers/video/fbmem.c \
$(TOPDIR)/drivers/video/fbcmap.c \ $(TOPDIR)/drivers/video/fbcmap.c \
......
...@@ -285,6 +285,7 @@ ...@@ -285,6 +285,7 @@
!Edrivers/usb/core/urb.c !Edrivers/usb/core/urb.c
!Edrivers/usb/core/config.c !Edrivers/usb/core/config.c
!Edrivers/usb/core/message.c !Edrivers/usb/core/message.c
!Edrivers/usb/core/file.c
!Edrivers/usb/core/usb.c !Edrivers/usb/core/usb.c
</sect1> </sect1>
......
...@@ -108,7 +108,7 @@ delete_inode: no ...@@ -108,7 +108,7 @@ delete_inode: no
clear_inode: no clear_inode: no
put_super: yes yes maybe (see below) put_super: yes yes maybe (see below)
write_super: no yes maybe (see below) write_super: no yes maybe (see below)
statfs: yes no no statfs: no no no
remount_fs: yes yes maybe (see below) remount_fs: yes yes maybe (see below)
umount_begin: yes no maybe (see below) umount_begin: yes no maybe (see below)
......
...@@ -247,6 +247,9 @@ ChangeLog ...@@ -247,6 +247,9 @@ ChangeLog
Note, a technical ChangeLog aimed at kernel hackers is in fs/ntfs/ChangeLog. Note, a technical ChangeLog aimed at kernel hackers is in fs/ntfs/ChangeLog.
2.0.14:
- Internal changes improving run list merging code and minor locking
change to not rely on BKL in ntfs_statfs().
2.0.13: 2.0.13:
- Internal changes towards using iget5_locked() in preparation for - Internal changes towards using iget5_locked() in preparation for
fake inodes and small cleanups to ntfs_volume structure. fake inodes and small cleanups to ntfs_volume structure.
......
...@@ -83,7 +83,7 @@ can relax your locking. ...@@ -83,7 +83,7 @@ can relax your locking.
[mandatory] [mandatory]
->lookup(), ->truncate(), ->create(), ->unlink(), ->mknod(), ->mkdir(), ->lookup(), ->truncate(), ->create(), ->unlink(), ->mknod(), ->mkdir(),
->rmdir(), ->link(), ->lseek(), ->symlink(), ->rename(), ->permission() ->rmdir(), ->link(), ->lseek(), ->symlink(), ->rename()
and ->readdir() are called without BKL now. Grab it on entry, drop upon return and ->readdir() are called without BKL now. Grab it on entry, drop upon return
- that will guarantee the same locking you used to have. If your method or its - that will guarantee the same locking you used to have. If your method or its
parts do not need BKL - better yet, now you can shift lock_kernel() and parts do not need BKL - better yet, now you can shift lock_kernel() and
...@@ -231,6 +231,22 @@ anything from oops to silent memory corruption. ...@@ -231,6 +231,22 @@ anything from oops to silent memory corruption.
is still alive, but only because of the mess in drivers/s390/block/dasd.c. is still alive, but only because of the mess in drivers/s390/block/dasd.c.
As soon as it gets fixed is_read_only() will die. As soon as it gets fixed is_read_only() will die.
---
[mandatory]
->permission() is called without BKL now. Grab it on entry, drop upon
return - that will guarantee the same locking you used to have. If
your method or its parts do not need BKL - better yet, now you can
shift lock_kernel() and unlock_kernel() so that they would protect
exactly what needs to be protected.
---
[mandatory]
->statfs() is now called without BKL held. BKL should have been
shifted into individual fs sb_op functions where it's not clear that
it's safe to remove it. If you don't need it, remove it.
--- ---
[mandatory] [mandatory]
......
VERSION = 2 VERSION = 2
PATCHLEVEL = 5 PATCHLEVEL = 5
SUBLEVEL = 24 SUBLEVEL = 25
EXTRAVERSION = EXTRAVERSION =
# *DOCUMENTATION*
# Too see a list of typical targets execute "make help"
# More info can be located in ./Documentation/kbuild
# Comments in this file is targeted only to the developer, do not
# expect to learn how to build the kernel reading this file.
# We are using a recursive build, so we need to do a little thinking # We are using a recursive build, so we need to do a little thinking
# to get the ordering right. # to get the ordering right.
# #
...@@ -140,16 +146,23 @@ export VERSION PATCHLEVEL SUBLEVEL EXTRAVERSION KERNELRELEASE ARCH \ ...@@ -140,16 +146,23 @@ export VERSION PATCHLEVEL SUBLEVEL EXTRAVERSION KERNELRELEASE ARCH \
CONFIG_SHELL TOPDIR HPATH HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC \ CONFIG_SHELL TOPDIR HPATH HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC \
CPP AR NM STRIP OBJCOPY OBJDUMP MAKE MAKEFILES GENKSYMS PERL CPP AR NM STRIP OBJCOPY OBJDUMP MAKE MAKEFILES GENKSYMS PERL
export CPPFLAGS EXPORT_FLAGS NOSTDINC_FLAGS export CPPFLAGS EXPORT_FLAGS NOSTDINC_FLAGS OBJCOPYFLAGS
export CFLAGS CFLAGS_KERNEL CFLAGS_MODULE export CFLAGS CFLAGS_KERNEL CFLAGS_MODULE
export AFLAGS AFLAGS_KERNEL AFLAGS_MODULE export AFLAGS AFLAGS_KERNEL AFLAGS_MODULE
src := .
obj := .
srctree := $(TOPDIR)
objtree := $(TOPDIR)
export srctree objtree
SUBDIRS := init kernel mm fs ipc lib drivers sound net SUBDIRS := init kernel mm fs ipc lib drivers sound net
noconfig_targets := xconfig menuconfig config oldconfig randconfig \ noconfig_targets := xconfig menuconfig config oldconfig randconfig \
defconfig allyesconfig allnoconfig allmodconfig \ defconfig allyesconfig allnoconfig allmodconfig \
clean mrproper distclean \ clean mrproper distclean \
tags TAGS sgmldocs psdocs pdfdocs htmldocs \ help tags TAGS sgmldocs psdocs pdfdocs htmldocs \
checkconfig checkhelp checkincludes checkconfig checkhelp checkincludes
ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),) ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
...@@ -217,7 +230,7 @@ NETWORKS := net/network.o ...@@ -217,7 +230,7 @@ NETWORKS := net/network.o
include arch/$(ARCH)/Makefile include arch/$(ARCH)/Makefile
export NETWORKS DRIVERS LIBS HEAD LDFLAGS LINKFLAGS MAKEBOOT ASFLAGS export NETWORKS DRIVERS LIBS HEAD LDFLAGS MAKEBOOT ASFLAGS
# boot target # boot target
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
...@@ -238,7 +251,7 @@ boot: vmlinux ...@@ -238,7 +251,7 @@ boot: vmlinux
vmlinux-objs := $(HEAD) $(INIT) $(CORE_FILES) $(LIBS) $(DRIVERS) $(NETWORKS) vmlinux-objs := $(HEAD) $(INIT) $(CORE_FILES) $(LIBS) $(DRIVERS) $(NETWORKS)
quiet_cmd_link_vmlinux = LD $@ quiet_cmd_link_vmlinux = LD $@
cmd_link_vmlinux = $(LD) $(LINKFLAGS) $(HEAD) $(INIT) \ cmd_link_vmlinux = $(LD) $(LDFLAGS) $(LDFLAGS_$(@F)) $(HEAD) $(INIT) \
--start-group \ --start-group \
$(CORE_FILES) \ $(CORE_FILES) \
$(LIBS) \ $(LIBS) \
...@@ -255,7 +268,7 @@ define rule_link_vmlinux ...@@ -255,7 +268,7 @@ define rule_link_vmlinux
. scripts/mkversion > .tmpversion . scripts/mkversion > .tmpversion
mv -f .tmpversion .version mv -f .tmpversion .version
+$(MAKE) -C init +$(MAKE) -C init
$(call cmd,cmd_link_vmlinux) $(call cmd,link_vmlinux)
$(cmd_link_vmlinux) $(cmd_link_vmlinux)
echo 'cmd_$@ := $(cmd_link_vmlinux)' > $(@D)/.$(@F).cmd echo 'cmd_$@ := $(cmd_link_vmlinux)' > $(@D)/.$(@F).cmd
$(NM) vmlinux | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | sort > System.map $(NM) vmlinux | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | sort > System.map
...@@ -679,6 +692,43 @@ tags: FORCE ...@@ -679,6 +692,43 @@ tags: FORCE
find $(SUBDIRS) init -name SCCS -prune -o -name BitKeeper -prune -o \ find $(SUBDIRS) init -name SCCS -prune -o -name BitKeeper -prune -o \
-name '*.[ch]' -print | xargs ctags $$CTAGSF -a -name '*.[ch]' -print | xargs ctags $$CTAGSF -a
# Brief documentation of the typical targets used
# ---------------------------------------------------------------------------
help:
@echo 'Cleaning targets:'
@echo ' clean - remove most generated files but keep the config'
@echo ' mrproper - remove all generated files including the config'
@echo ' distclean - mrproper + remove files generated by editors and patch'
@echo ''
@echo 'Configuration targets:'
@echo ' oldconfig - Update current config utilising a line-oriented program'
@echo ' menuconfig - Update current config utilising a menu based program'
@echo ' xconfig - Update current config utilising a X-based program'
@echo ' defconfig - New config with default answer to all options'
@echo ' allmodconfig - New config selecting modules when possible'
@echo ' allyesconfig - New config where all options are accepted with yes'
@echo ' allnoconfig - New minimal config'
@echo ''
@echo 'Other generic targets:'
@echo ' all - Build all targets marked with [*]'
@echo ' dep - Create module version information'
@echo '* vmlinux - Build the bare kernel'
@echo '* modules - Build all modules'
@echo ' dir/file.[ois]- Build specified target only'
@echo ' rpm - Build a kernel as an RPM package'
@echo ' tags/TAGS - Generate tags file for editors'
@echo ''
@echo 'Documentation targets:'
@$(MAKE) --no-print-directory -f Documentation/DocBook/Makefile dochelp
@echo ''
@echo 'Architecture specific targets ($(ARCH)):'
@$(MAKE) --no-print-directory -f arch/$(ARCH)/boot/Makefile archhelp
@echo ''
@echo 'Execute "make" or "make all" to build all targets marked with [*] '
@echo 'For further info browse Documentation/kbuild/*'
# Documentation targets # Documentation targets
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
...@@ -735,9 +785,9 @@ if_changed_rule = $(if $(strip $? \ ...@@ -735,9 +785,9 @@ if_changed_rule = $(if $(strip $? \
$(filter-out $(cmd_$(@F)),$(cmd_$(1)))),\ $(filter-out $(cmd_$(@F)),$(cmd_$(1)))),\
@$(rule_$(1))) @$(rule_$(1)))
# If quiet is set, only print short version of rule # If quiet is set, only print short version of command
cmd = @$(if $($(quiet)$(1)),echo ' $($(quiet)$(1))' &&) $($(1)) cmd = @$(if $($(quiet)cmd_$(1)),echo ' $($(quiet)cmd_$(1))' &&) $(cmd_$(1))
define update-if-changed define update-if-changed
if [ -r $@ ] && cmp -s $@ $@.tmp; then \ if [ -r $@ ] && cmp -s $@ $@.tmp; then \
......
...@@ -34,7 +34,7 @@ endif ...@@ -34,7 +34,7 @@ endif
# $(srctree)/include/linux/module.h : Some file relative to the source # $(srctree)/include/linux/module.h : Some file relative to the source
# dir root # dir root
# #
# Those can only be used in the section after # $(obj) and $(src) can only be used in the section after
# include $(TOPDIR)/Rules.make, i.e for generated files and the like. # include $(TOPDIR)/Rules.make, i.e for generated files and the like.
# Intentionally. # Intentionally.
# #
...@@ -43,8 +43,10 @@ endif ...@@ -43,8 +43,10 @@ endif
obj := . obj := .
src := . src := .
objtree := $(TOPDIR)
srctree := $(TOPDIR) # For use in the quiet output
echo_target = $(RELDIR)/$@
# Figure out what we need to build from the various variables # Figure out what we need to build from the various variables
# =========================================================================== # ===========================================================================
...@@ -269,25 +271,25 @@ c_flags = -Wp,-MD,$(depfile) $(CFLAGS) $(NOSTDINC_FLAGS) \ ...@@ -269,25 +271,25 @@ c_flags = -Wp,-MD,$(depfile) $(CFLAGS) $(NOSTDINC_FLAGS) \
-DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) \ -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) \
$(export_flags) $(export_flags)
quiet_cmd_cc_s_c = CC $(RELDIR)/$@ quiet_cmd_cc_s_c = CC $(echo_target)
cmd_cc_s_c = $(CC) $(c_flags) -S -o $@ $< cmd_cc_s_c = $(CC) $(c_flags) -S -o $@ $<
%.s: %.c FORCE %.s: %.c FORCE
$(call if_changed_dep,cc_s_c) $(call if_changed_dep,cc_s_c)
quiet_cmd_cc_i_c = CPP $(RELDIR)/$@ quiet_cmd_cc_i_c = CPP $(echo_target)
cmd_cc_i_c = $(CPP) $(c_flags) -o $@ $< cmd_cc_i_c = $(CPP) $(c_flags) -o $@ $<
%.i: %.c FORCE %.i: %.c FORCE
$(call if_changed_dep,cc_i_c) $(call if_changed_dep,cc_i_c)
quiet_cmd_cc_o_c = CC $(RELDIR)/$@ quiet_cmd_cc_o_c = CC $(echo_target)
cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $< cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $<
%.o: %.c FORCE %.o: %.c FORCE
$(call if_changed_dep,cc_o_c) $(call if_changed_dep,cc_o_c)
quiet_cmd_cc_lst_c = ' Generating $(RELDIR)/$@' quiet_cmd_cc_lst_c = ' Generating $(echo_target)'
cmd_cc_lst_c = $(CC) $(c_flags) -g -c -o $*.o $< && $(TOPDIR)/scripts/makelst $*.o $(TOPDIR)/System.map $(OBJDUMP) > $@ cmd_cc_lst_c = $(CC) $(c_flags) -g -c -o $*.o $< && $(TOPDIR)/scripts/makelst $*.o $(TOPDIR)/System.map $(OBJDUMP) > $@
%.lst: %.c FORCE %.lst: %.c FORCE
...@@ -304,13 +306,13 @@ $(real-objs-m:.o=.s): modkern_aflags := $(AFLAGS_MODULE) ...@@ -304,13 +306,13 @@ $(real-objs-m:.o=.s): modkern_aflags := $(AFLAGS_MODULE)
a_flags = -Wp,-MD,$(depfile) $(AFLAGS) $(NOSTDINC_FLAGS) \ a_flags = -Wp,-MD,$(depfile) $(AFLAGS) $(NOSTDINC_FLAGS) \
$(modkern_aflags) $(EXTRA_AFLAGS) $(AFLAGS_$(*F).o) $(modkern_aflags) $(EXTRA_AFLAGS) $(AFLAGS_$(*F).o)
quiet_cmd_as_s_S = CPP $(RELDIR)/$@ quiet_cmd_as_s_S = CPP $(echo_target)
cmd_as_s_S = $(CPP) $(a_flags) -o $@ $< cmd_as_s_S = $(CPP) $(a_flags) -o $@ $<
%.s: %.S FORCE %.s: %.S FORCE
$(call if_changed_dep,as_s_S) $(call if_changed_dep,as_s_S)
quiet_cmd_as_o_S = AS $(RELDIR)/$@ quiet_cmd_as_o_S = AS $(echo_target)
cmd_as_o_S = $(CC) $(a_flags) -c -o $@ $< cmd_as_o_S = $(CC) $(a_flags) -c -o $@ $<
%.o: %.S FORCE %.o: %.S FORCE
...@@ -328,10 +330,10 @@ $(sort $(subdir-obj-y)): sub_dirs ; ...@@ -328,10 +330,10 @@ $(sort $(subdir-obj-y)): sub_dirs ;
# Rule to compile a set of .o files into one .o file # Rule to compile a set of .o files into one .o file
# #
ifdef O_TARGET ifdef O_TARGET
quiet_cmd_link_o_target = LD $(RELDIR)/$@ quiet_cmd_link_o_target = LD $(echo_target)
# If the list of objects to link is empty, just create an empty O_TARGET # If the list of objects to link is empty, just create an empty O_TARGET
cmd_link_o_target = $(if $(strip $(obj-y)),\ cmd_link_o_target = $(if $(strip $(obj-y)),\
$(LD) $(EXTRA_LDFLAGS) -r -o $@ $(filter $(obj-y), $^),\ $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) -r -o $@ $(filter $(obj-y), $^),\
rm -f $@; $(AR) rcs $@) rm -f $@; $(AR) rcs $@)
$(O_TARGET): $(obj-y) FORCE $(O_TARGET): $(obj-y) FORCE
...@@ -344,7 +346,7 @@ endif # O_TARGET ...@@ -344,7 +346,7 @@ endif # O_TARGET
# Rule to compile a set of .o files into one .a file # Rule to compile a set of .o files into one .a file
# #
ifdef L_TARGET ifdef L_TARGET
quiet_cmd_link_l_target = AR $(RELDIR)/$@ quiet_cmd_link_l_target = AR $(echo_target)
cmd_link_l_target = rm -f $@; $(AR) $(EXTRA_ARFLAGS) rcs $@ $(obj-y) cmd_link_l_target = rm -f $@; $(AR) $(EXTRA_ARFLAGS) rcs $@ $(obj-y)
$(L_TARGET): $(obj-y) FORCE $(L_TARGET): $(obj-y) FORCE
...@@ -357,8 +359,8 @@ endif ...@@ -357,8 +359,8 @@ endif
# Rule to link composite objects # Rule to link composite objects
# #
quiet_cmd_link_multi = LD $(RELDIR)/$@ quiet_cmd_link_multi = LD $(echo_target)
cmd_link_multi = $(LD) $(EXTRA_LDFLAGS) -r -o $@ $(filter $($(basename $@)-objs),$^) cmd_link_multi = $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) -r -o $@ $(filter $($(basename $@)-objs),$^)
# We would rather have a list of rules like # We would rather have a list of rules like
# foo.o: $(foo-objs) # foo.o: $(foo-objs)
...@@ -379,22 +381,22 @@ host-progs-single := $(foreach m,$(host-progs),$(if $($(m)-objs),,$(m))) ...@@ -379,22 +381,22 @@ host-progs-single := $(foreach m,$(host-progs),$(if $($(m)-objs),,$(m)))
host-progs-multi := $(foreach m,$(host-progs),$(if $($(m)-objs),$(m))) host-progs-multi := $(foreach m,$(host-progs),$(if $($(m)-objs),$(m)))
host-progs-multi-objs := $(foreach m,$(host-progs-multi),$($(m)-objs)) host-progs-multi-objs := $(foreach m,$(host-progs-multi),$($(m)-objs))
quiet_cmd_host_cc__c = HOSTCC $(RELDIR)/$@ quiet_cmd_host_cc__c = HOSTCC $(echo_target)
cmd_host_cc__c = $(HOSTCC) -Wp,-MD,.$(subst /,_,$@).d \ cmd_host_cc__c = $(HOSTCC) -Wp,-MD,$(depfile) \
$(HOSTCFLAGS) $(HOST_EXTRACFLAGS) \ $(HOSTCFLAGS) $(HOST_EXTRACFLAGS) \
$(HOST_LOADLIBES) -o $@ $< $(HOST_LOADLIBES) -o $@ $<
$(host-progs-single): %: %.c FORCE $(host-progs-single): %: %.c FORCE
$(call if_changed_dep,host_cc__c) $(call if_changed_dep,host_cc__c)
quiet_cmd_host_cc_o_c = HOSTCC $(RELDIR)/$@ quiet_cmd_host_cc_o_c = HOSTCC $(echo_target)
cmd_host_cc_o_c = $(HOSTCC) -Wp,-MD,.$(subst /,_,$@).d \ cmd_host_cc_o_c = $(HOSTCC) -Wp,-MD,$(depfile) \
$(HOSTCFLAGS) $(HOST_EXTRACFLAGS) -c -o $@ $< $(HOSTCFLAGS) $(HOST_EXTRACFLAGS) -c -o $@ $<
$(host-progs-multi-objs): %.o: %.c FORCE $(host-progs-multi-objs): %.o: %.c FORCE
$(call if_changed_dep,host_cc_o_c) $(call if_changed_dep,host_cc_o_c)
quiet_cmd_host_cc__o = HOSTLD $(RELDIR)/$@ quiet_cmd_host_cc__o = HOSTLD $(echo_target)
cmd_host_cc__o = $(HOSTCC) $(HOSTLDFLAGS) -o $@ $($@-objs) \ cmd_host_cc__o = $(HOSTCC) $(HOSTLDFLAGS) -o $@ $($@-objs) \
$(HOST_LOADLIBES) $(HOST_LOADLIBES)
...@@ -410,9 +412,39 @@ endif # ! fastdep ...@@ -410,9 +412,39 @@ endif # ! fastdep
# =========================================================================== # ===========================================================================
%:: %_shipped %:: %_shipped
@echo ' CP $(RELDIR)/$@' @echo ' CP $(echo_target)'
@cp $< $@ @cp $< $@
# Commands useful for building a boot image
# ===========================================================================
#
# Use as following:
#
# target: source(s) FORCE
# $(if_changed,ld/objcopy)
#
# and add target to EXTRA_TARGETS so that we know we have to
# read in the saved command line
# Linking
# ---------------------------------------------------------------------------
quiet_cmd_ld = LD $(echo_target)
cmd_ld = $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_$@) \
$(filter-out FORCE,$^) -o $@
# Objcopy
# ---------------------------------------------------------------------------
quiet_cmd_objcopy = OBJCPY $(echo_target)
cmd_objcopy = $(OBJCOPY) $(OBJCOPYFLAGS) $< $@
# Gzip
# ---------------------------------------------------------------------------
quiet_cmd_gzip = GZIP $(echo_target)
cmd_gzip = gzip -f -9 < $< > $@
# =========================================================================== # ===========================================================================
# Generic stuff # Generic stuff
# =========================================================================== # ===========================================================================
...@@ -520,4 +552,4 @@ if_changed_rule = $(if $(strip $? \ ...@@ -520,4 +552,4 @@ if_changed_rule = $(if $(strip $? \
# If quiet is set, only print short version of command # If quiet is set, only print short version of command
cmd = @$(if $($(quiet)$(1)),echo ' $($(quiet)$(1))' &&) $($(1)) cmd = @$(if $($(quiet)cmd_$(1)),echo ' $($(quiet)cmd_$(1))' &&) $(cmd_$(1))
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
NM := $(NM) -B NM := $(NM) -B
LINKFLAGS = -static -T arch/alpha/vmlinux.lds -N #-relax LDFLAGS_vmlinux = -static -T arch/alpha/vmlinux.lds -N #-relax
CFLAGS := $(CFLAGS) -pipe -mno-fp-regs -ffixed-8 CFLAGS := $(CFLAGS) -pipe -mno-fp-regs -ffixed-8
# Determine if we can use the BWX instructions with GAS. # Determine if we can use the BWX instructions with GAS.
......
...@@ -7,7 +7,8 @@ ...@@ -7,7 +7,8 @@
# #
# Copyright (C) 1995-2001 by Russell King # Copyright (C) 1995-2001 by Russell King
LINKFLAGS :=-p -X -T arch/arm/vmlinux.lds LDFLAGS_vmlinux :=-p -X -T arch/arm/vmlinux.lds
OBJCOPYFLAGS :=-O binary -R .note -R .comment -S
GZFLAGS :=-9 GZFLAGS :=-9
CFLAGS +=-pipe CFLAGS +=-pipe
......
...@@ -115,15 +115,15 @@ endif ...@@ -115,15 +115,15 @@ endif
export SYSTEM ZTEXTADDR ZBSSADDR ZRELADDR INITRD_PHYS PARAMS_PHYS export SYSTEM ZTEXTADDR ZBSSADDR ZRELADDR INITRD_PHYS PARAMS_PHYS
Image: $(SYSTEM) Image: $(SYSTEM)
$(OBJCOPY) -O binary -R .note -R .comment -S $(SYSTEM) $@ $(OBJCOPY) $(OBJCOPYFLAGS) $< $@
bzImage: zImage bzImage: zImage
zImage: compressed/vmlinux zImage: compressed/vmlinux
$(OBJCOPY) -O binary -R .note -R .comment -S compressed/vmlinux $@ $(OBJCOPY) $(OBJCOPYFLAGS) $< $@
bootpImage: bootp/bootp bootpImage: bootp/bootp
$(OBJCOPY) -O binary -R .note -R .comment -S bootp/bootp $@ $(OBJCOPY) $(OBJCOPYFLAGS) $< $@
compressed/vmlinux: $(TOPDIR)/vmlinux compressed/vmlinux: $(TOPDIR)/vmlinux
@$(MAKE) -C compressed vmlinux @$(MAKE) -C compressed vmlinux
......
...@@ -78,7 +78,7 @@ $(HEAD): $(HEAD:.o=.S) ...@@ -78,7 +78,7 @@ $(HEAD): $(HEAD:.o=.S)
$(CC) $(AFLAGS) -traditional -c $(HEAD:.o=.S) $(CC) $(AFLAGS) -traditional -c $(HEAD:.o=.S)
piggy.o: $(SYSTEM) piggy.o: $(SYSTEM)
$(OBJCOPY) -O binary -R .note -R .comment -S $(SYSTEM) piggy $(OBJCOPY) $(OBJCOPYFLAGS) $(SYSTEM) piggy
gzip $(GZFLAGS) < piggy > piggy.gz gzip $(GZFLAGS) < piggy > piggy.gz
$(LD) -r -o $@ -b binary piggy.gz $(LD) -r -o $@ -b binary piggy.gz
rm -f piggy piggy.gz rm -f piggy piggy.gz
......
...@@ -31,11 +31,11 @@ LD = if [ ! -e $(LD_SCRIPT).tmp -o $(LD_SCRIPT) -nt $(LD_SCRIPT).tmp ]; then \ ...@@ -31,11 +31,11 @@ LD = if [ ! -e $(LD_SCRIPT).tmp -o $(LD_SCRIPT) -nt $(LD_SCRIPT).tmp ]; then \
else true; \ else true; \
fi && $(CROSS_COMPILE)ld -mcrislinux fi && $(CROSS_COMPILE)ld -mcrislinux
LINKFLAGS = -T $(LD_SCRIPT).tmp LDFLAGS_vmlinux = -T $(LD_SCRIPT).tmp
# objcopy is used to make binary images from the resulting linked file # objcopy is used to make binary images from the resulting linked file
OBJCOPY := $(CROSS_COMPILE)objcopy -O binary -R .note -R .comment -S OBJCOPYFLAGS := -O binary -R .note -R .comment -S
# -mlinux enables -march=v10, -fno-underscores, -D__linux__ among others # -mlinux enables -march=v10, -fno-underscores, -D__linux__ among others
...@@ -64,7 +64,7 @@ LIBS := $(TOPDIR)/arch/cris/lib/lib.a $(LIBS) $(TOPDIR)/arch/cris/lib/lib.a $(LI ...@@ -64,7 +64,7 @@ LIBS := $(TOPDIR)/arch/cris/lib/lib.a $(LIBS) $(TOPDIR)/arch/cris/lib/lib.a $(LI
MAKEBOOT = $(MAKE) -C arch/$(ARCH)/boot MAKEBOOT = $(MAKE) -C arch/$(ARCH)/boot
vmlinux.bin: vmlinux vmlinux.bin: vmlinux
$(OBJCOPY) vmlinux vmlinux.bin $(OBJCOPY) $(OBJCOPYFLAGS) vmlinux vmlinux.bin
timage: vmlinux.bin timage: vmlinux.bin
cat vmlinux.bin cramfs.img >timage cat vmlinux.bin cramfs.img >timage
......
...@@ -8,7 +8,7 @@ CC = gcc-cris -melf -I $(TOPDIR)/include ...@@ -8,7 +8,7 @@ CC = gcc-cris -melf -I $(TOPDIR)/include
CFLAGS = -O2 CFLAGS = -O2
LD = ld-cris LD = ld-cris
OBJCOPY = objcopy-cris OBJCOPY = objcopy-cris
OBJCOPYFLAGS = -O binary --remove-section=.bss
OBJECTS = head.o misc.o OBJECTS = head.o misc.o
# files to compress # files to compress
...@@ -18,7 +18,7 @@ all: vmlinuz ...@@ -18,7 +18,7 @@ all: vmlinuz
decompress.bin: $(OBJECTS) decompress.bin: $(OBJECTS)
$(LD) -T decompress.ld -o decompress.o $(OBJECTS) $(LD) -T decompress.ld -o decompress.o $(OBJECTS)
$(OBJCOPY) -O binary --remove-section=.bss decompress.o decompress.bin $(OBJCOPY) $(OBJCOPYFLAGS) decompress.o decompress.bin
# save it for mkprod in the topdir. # save it for mkprod in the topdir.
cp decompress.bin $(TOPDIR) cp decompress.bin $(TOPDIR)
......
...@@ -8,6 +8,7 @@ CC = gcc-cris -mlinux -I $(TOPDIR)/include ...@@ -8,6 +8,7 @@ CC = gcc-cris -mlinux -I $(TOPDIR)/include
CFLAGS = -O2 CFLAGS = -O2
LD = gcc-cris -mlinux -nostdlib LD = gcc-cris -mlinux -nostdlib
OBJCOPY = objcopy-cris OBJCOPY = objcopy-cris
OBJCOPYFLAGS = -O binary --remove-section=.bss
all: rescue.bin testrescue.bin kimagerescue.bin all: rescue.bin testrescue.bin kimagerescue.bin
...@@ -16,11 +17,11 @@ rescue: rescue.bin ...@@ -16,11 +17,11 @@ rescue: rescue.bin
rescue.bin: head.o rescue.bin: head.o
$(LD) -T rescue.ld -o rescue.o head.o $(LD) -T rescue.ld -o rescue.o head.o
$(OBJCOPY) -O binary --remove-section=.bss rescue.o rescue.bin $(OBJCOPY) $(OBJCOPYFLAGS) rescue.o rescue.bin
cp rescue.bin $(TOPDIR) cp rescue.bin $(TOPDIR)
testrescue.bin: testrescue.o testrescue.bin: testrescue.o
$(OBJCOPY) -O binary --remove-section=.bss testrescue.o tr.bin $(OBJCOPY) $(OBJCOPYFLAGS) testrescue.o tr.bin
# Pad it to 784 bytes # Pad it to 784 bytes
dd if=/dev/zero of=tmp2423 bs=1 count=784 dd if=/dev/zero of=tmp2423 bs=1 count=784
cat tr.bin tmp2423 >testrescue_tmp.bin cat tr.bin tmp2423 >testrescue_tmp.bin
...@@ -28,7 +29,7 @@ testrescue.bin: testrescue.o ...@@ -28,7 +29,7 @@ testrescue.bin: testrescue.o
rm tr.bin tmp2423 testrescue_tmp.bin rm tr.bin tmp2423 testrescue_tmp.bin
kimagerescue.bin: kimagerescue.o kimagerescue.bin: kimagerescue.o
$(OBJCOPY) -O binary --remove-section=.bss kimagerescue.o ktr.bin $(OBJCOPY) $(OBJCOPYFLAGS) kimagerescue.o ktr.bin
# Pad it to 784 bytes, that's what the rescue loader expects # Pad it to 784 bytes, that's what the rescue loader expects
dd if=/dev/zero of=tmp2423 bs=1 count=784 dd if=/dev/zero of=tmp2423 bs=1 count=784
cat ktr.bin tmp2423 >kimagerescue_tmp.bin cat ktr.bin tmp2423 >kimagerescue_tmp.bin
......
...@@ -16,10 +16,9 @@ ...@@ -16,10 +16,9 @@
# Added '-march' and '-mpreferred-stack-boundary' support # Added '-march' and '-mpreferred-stack-boundary' support
# #
LD=$(CROSS_COMPILE)ld -m elf_i386 LDFLAGS := -m elf_i386
OBJCOPY=$(CROSS_COMPILE)objcopy -O binary -R .note -R .comment -S OBJCOPYFLAGS := -O binary -R .note -R .comment -S
LDFLAGS=-e stext LDFLAGS_vmlinux := -T arch/i386/vmlinux.lds -e stext
LINKFLAGS =-T $(TOPDIR)/arch/i386/vmlinux.lds $(LDFLAGS)
CFLAGS += -pipe CFLAGS += -pipe
...@@ -103,7 +102,7 @@ SUBDIRS += arch/i386/pci ...@@ -103,7 +102,7 @@ SUBDIRS += arch/i386/pci
DRIVERS += arch/i386/pci/pci.o DRIVERS += arch/i386/pci/pci.o
endif endif
MAKEBOOT = $(MAKE) -C arch/$(ARCH)/boot MAKEBOOT = +$(MAKE) -C arch/$(ARCH)/boot
vmlinux: arch/i386/vmlinux.lds vmlinux: arch/i386/vmlinux.lds
......
...@@ -25,25 +25,44 @@ SVGA_MODE := -DSVGA_MODE=NORMAL_VGA ...@@ -25,25 +25,44 @@ SVGA_MODE := -DSVGA_MODE=NORMAL_VGA
#RAMDISK := -DRAMDISK=512 #RAMDISK := -DRAMDISK=512
EXTRA_TARGETS := vmlinux.bin bvmlinux.bin bootsect bootsect.o \
setup setup.o zImage bzImage
host-progs := tools/build
# Default
boot: bzImage
include $(TOPDIR)/Rules.make
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
BOOT_INCL = $(TOPDIR)/include/linux/config.h \ zImage: IMAGE_OFFSET := 0x1000
$(TOPDIR)/include/linux/autoconf.h \ zImage: EXTRA_AFLAGS := -traditional $(SVGA_MODE) $(RAMDISK)
$(TOPDIR)/include/asm/boot.h bzImage: IMAGE_OFFSET := 0x100000
bzImage: EXTRA_AFLAGS := -traditional $(SVGA_MODE) $(RAMDISK) -D__BIG_KERNEL__
bzImage: BUILDFLAGS := -b
quiet_cmd_image = BUILD $(RELDIR)/$@
cmd_image = tools/build $(BUILDFLAGS) bootsect setup vmlinux.bin \
$(ROOT_DEV) > $@
zImage: bootsect setup compressed/vmlinux tools/build zImage bzImage: bootsect setup vmlinux.bin tools/build FORCE
$(OBJCOPY) compressed/vmlinux compressed/vmlinux.out $(call if_changed,image)
tools/build bootsect setup compressed/vmlinux.out $(ROOT_DEV) > zImage
bzImage: bbootsect bsetup compressed/bvmlinux tools/build vmlinux.bin: compressed/vmlinux FORCE
$(OBJCOPY) compressed/bvmlinux compressed/bvmlinux.out $(call if_changed,objcopy)
tools/build -b bbootsect bsetup compressed/bvmlinux.out $(ROOT_DEV) > bzImage
compressed/vmlinux: $(TOPDIR)/vmlinux LDFLAGS_bootsect := -Ttext 0x0 -s --oformat binary
@$(MAKE) -C compressed vmlinux LDFLAGS_setup := -Ttext 0x0 -s --oformat binary -e begtext
setup bootsect: %: %.o FORCE
$(call if_changed,ld)
compressed/vmlinux: FORCE
@$(MAKE) IMAGE_OFFSET=$(IMAGE_OFFSET) -C compressed vmlinux
compressed/bvmlinux: $(TOPDIR)/vmlinux
@$(MAKE) -C compressed bvmlinux
zdisk: $(BOOTIMAGE) zdisk: $(BOOTIMAGE)
dd bs=8192 if=$(BOOTIMAGE) of=/dev/fd0 dd bs=8192 if=$(BOOTIMAGE) of=/dev/fd0
...@@ -58,48 +77,17 @@ zlilo: $(BOOTIMAGE) ...@@ -58,48 +77,17 @@ zlilo: $(BOOTIMAGE)
install: $(BOOTIMAGE) install: $(BOOTIMAGE)
sh -x ./install.sh $(KERNELRELEASE) $(BOOTIMAGE) $(TOPDIR)/System.map "$(INSTALL_PATH)" sh -x ./install.sh $(KERNELRELEASE) $(BOOTIMAGE) $(TOPDIR)/System.map "$(INSTALL_PATH)"
tools/build: tools/build.c
$(HOSTCC) $(HOSTCFLAGS) -o $@ $< -I$(TOPDIR)/include
bootsect: bootsect.o
$(LD) -Ttext 0x0 -s --oformat binary -o $@ $<
bootsect.o: bootsect.s
$(AS) -o $@ $<
bootsect.s: bootsect.S Makefile $(BOOT_INCL)
$(CPP) $(CPPFLAGS) -traditional $(SVGA_MODE) $(RAMDISK) $< -o $@
bbootsect: bbootsect.o
$(LD) -Ttext 0x0 -s --oformat binary $< -o $@
bbootsect.o: bbootsect.s
$(AS) -o $@ $<
bbootsect.s: bootsect.S Makefile $(BOOT_INCL)
$(CPP) $(CPPFLAGS) -D__BIG_KERNEL__ -traditional $(SVGA_MODE) $(RAMDISK) $< -o $@
setup: setup.o
$(LD) -Ttext 0x0 -s --oformat binary -e begtext -o $@ $<
setup.o: setup.s
$(AS) -o $@ $<
setup.s: setup.S video.S Makefile $(BOOT_INCL) $(TOPDIR)/include/linux/version.h $(TOPDIR)/include/linux/compile.h
$(CPP) $(CPPFLAGS) -D__ASSEMBLY__ -traditional $(SVGA_MODE) $(RAMDISK) $< -o $@
bsetup: bsetup.o
$(LD) -Ttext 0x0 -s --oformat binary -e begtext -o $@ $<
bsetup.o: bsetup.s
$(AS) -o $@ $<
bsetup.s: setup.S video.S Makefile $(BOOT_INCL) $(TOPDIR)/include/linux/version.h $(TOPDIR)/include/linux/compile.h
$(CPP) $(CPPFLAGS) -D__BIG_KERNEL__ -D__ASSEMBLY__ -traditional $(SVGA_MODE) $(RAMDISK) $< -o $@
clean: clean:
@echo 'Cleaning up (boot)' @echo 'Cleaning up (boot)'
@rm -f tools/build @rm -f tools/build vmlinux.bin bvmlinux.bin
@rm -f setup bootsect zImage compressed/vmlinux.out @rm -f setup bootsect zImage compressed/vmlinux.out
@rm -f bsetup bbootsect bzImage compressed/bvmlinux.out @rm -f bsetup bbootsect bzImage compressed/bvmlinux.out
@$(MAKE) -C compressed clean @$(MAKE) -C compressed clean
archhelp:
@echo '* bzImage - Compressed kernel image (arch/$(ARCH)/boot/bzImage)'
@echo ' install - Install kernel using'
@echo ' (your) ~/bin/installkernel or'
@echo ' (distribution) /sbin/installkernel or'
@echo ' install to $$(INSTALL_PATH) and run lilo'
...@@ -4,47 +4,26 @@ ...@@ -4,47 +4,26 @@
# create a compressed vmlinux image from the original vmlinux # create a compressed vmlinux image from the original vmlinux
# #
HEAD = head.o EXTRA_TARGETS := vmlinux vmlinux.bin vmlinux.bin.gz head.o misc.o piggy.o
SYSTEM = $(TOPDIR)/vmlinux EXTRA_AFLAGS := -traditional
OBJECTS = $(HEAD) misc.o include $(TOPDIR)/Rules.make
ZLDFLAGS = -e startup_32 LDFLAGS_vmlinux := -Ttext $(IMAGE_OFFSET) -e startup_32
# vmlinux: head.o misc.o piggy.o FORCE
# ZIMAGE_OFFSET is the load offset of the compression loader $(call if_changed,ld)
# BZIMAGE_OFFSET is the load offset of the high loaded compression loader
#
ZIMAGE_OFFSET = 0x1000
BZIMAGE_OFFSET = 0x100000
ZLINKFLAGS = -Ttext $(ZIMAGE_OFFSET) $(ZLDFLAGS)
BZLINKFLAGS = -Ttext $(BZIMAGE_OFFSET) $(ZLDFLAGS)
all: vmlinux
vmlinux: piggy.o $(OBJECTS)
$(LD) $(ZLINKFLAGS) -o vmlinux $(OBJECTS) piggy.o
bvmlinux: piggy.o $(OBJECTS)
$(LD) $(BZLINKFLAGS) -o bvmlinux $(OBJECTS) piggy.o
head.o: head.S vmlinux.bin: $(TOPDIR)/vmlinux FORCE
$(CC) $(AFLAGS) -traditional -c head.S $(call if_changed,objcopy)
comma := , vmlinux.bin.gz: vmlinux.bin FORCE
$(call if_changed,gzip)
misc.o: misc.c LDFLAGS_piggy.o := -r --format binary --oformat elf32-i386 -T
$(CC) $(CFLAGS) -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) -c misc.c
piggy.o: $(SYSTEM) piggy.o: vmlinux.scr vmlinux.bin.gz FORCE
tmppiggy=_tmp_$$$$piggy; \ $(call if_changed,ld)
rm -f $$tmppiggy $$tmppiggy.gz $$tmppiggy.lnk; \
$(OBJCOPY) $(SYSTEM) $$tmppiggy; \
gzip -f -9 < $$tmppiggy > $$tmppiggy.gz; \
echo "SECTIONS { .data : { input_len = .; LONG(input_data_end - input_data) input_data = .; *(.data) input_data_end = .; }}" > $$tmppiggy.lnk; \
$(LD) -r -o piggy.o -b binary $$tmppiggy.gz -b elf32-i386 -T $$tmppiggy.lnk; \
rm -f $$tmppiggy $$tmppiggy.gz $$tmppiggy.lnk
clean: clean:
@rm -f vmlinux bvmlinux _tmp_* @rm -f vmlinux vmlinux.bin vmlinux.bin.gz
SECTIONS
{
.data : {
input_len = .;
LONG(input_data_end - input_data) input_data = .;
*(.data)
input_data_end = .;
}
}
...@@ -13,7 +13,8 @@ AWK := awk ...@@ -13,7 +13,8 @@ AWK := awk
export AWK export AWK
LINKFLAGS = -static -T arch/$(ARCH)/vmlinux.lds OBJCOPYFLAGS := --strip-all
LDFLAGS_vmlinux := -static -T arch/$(ARCH)/vmlinux.lds
AFLAGS_KERNEL := -mconstant-gp AFLAGS_KERNEL := -mconstant-gp
EXTRA = EXTRA =
...@@ -100,7 +101,7 @@ arch/$(ARCH)/vmlinux.lds: arch/$(ARCH)/vmlinux.lds.S FORCE ...@@ -100,7 +101,7 @@ arch/$(ARCH)/vmlinux.lds: arch/$(ARCH)/vmlinux.lds.S FORCE
-traditional arch/$(ARCH)/vmlinux.lds.S > $@ -traditional arch/$(ARCH)/vmlinux.lds.S > $@
compressed: vmlinux compressed: vmlinux
$(OBJCOPY) --strip-all vmlinux vmlinux-tmp $(OBJCOPY) $(OBJCOPYFLAGS) vmlinux vmlinux-tmp
gzip vmlinux-tmp gzip vmlinux-tmp
mv vmlinux-tmp.gz vmlinux.gz mv vmlinux-tmp.gz vmlinux.gz
......
...@@ -18,16 +18,16 @@ COMPILE_ARCH = $(shell uname -m) ...@@ -18,16 +18,16 @@ COMPILE_ARCH = $(shell uname -m)
# override top level makefile # override top level makefile
AS += -m68020 AS += -m68020
LD += -m m68kelf LDFLAGS := -m m68kelf
ifneq ($(COMPILE_ARCH),$(ARCH)) ifneq ($(COMPILE_ARCH),$(ARCH))
# prefix for cross-compiling binaries # prefix for cross-compiling binaries
CROSS_COMPILE = m68k-linux- CROSS_COMPILE = m68k-linux-
endif endif
ifndef CONFIG_SUN3 ifndef CONFIG_SUN3
LINKFLAGS = -T $(TOPDIR)/arch/m68k/vmlinux.lds LDFLAGS_vmlinux = -T $(TOPDIR)/arch/m68k/vmlinux.lds
else else
LINKFLAGS = -T $(TOPDIR)/arch/m68k/vmlinux-sun3.lds -N LDFLAGS_vmlinux = -T $(TOPDIR)/arch/m68k/vmlinux-sun3.lds -N
endif endif
# without -fno-strength-reduce the 53c7xx.c driver fails ;-( # without -fno-strength-reduce the 53c7xx.c driver fails ;-(
......
...@@ -36,9 +36,9 @@ endif ...@@ -36,9 +36,9 @@ endif
# crossformat linking we rely on the elf2ecoff tool for format conversion. # crossformat linking we rely on the elf2ecoff tool for format conversion.
# #
GCCFLAGS := -G 0 -mno-abicalls -fno-pic GCCFLAGS := -G 0 -mno-abicalls -fno-pic
LINKFLAGS += -static LDFLAGS_vmlinux += -static
MODFLAGS += -mlong-calls MODFLAGS += -mlong-calls
LD := $(LD) -G 0 LDFLAGS := -G 0
ifdef CONFIG_REMOTE_DEBUG ifdef CONFIG_REMOTE_DEBUG
CFLAGS := $(CFLAGS) -g CFLAGS := $(CFLAGS) -g
...@@ -270,7 +270,7 @@ vmlinux: arch/$(ARCH)/ld.script ...@@ -270,7 +270,7 @@ vmlinux: arch/$(ARCH)/ld.script
arch/$(ARCH)/ld.script: arch/$(ARCH)/ld.script.in arch/$(ARCH)/Makefile arch/$(ARCH)/ld.script: arch/$(ARCH)/ld.script.in arch/$(ARCH)/Makefile
sed -e 's/@@LOADADDR@@/$(LOADADDR)/' <$< >$@ sed -e 's/@@LOADADDR@@/$(LOADADDR)/' <$< >$@
LINKFLAGS += -T arch/$(ARCH)/ld.script LDFLAGS_vmlinux += -T arch/$(ARCH)/ld.script
HEAD := arch/mips/kernel/head.o arch/mips/kernel/init_task.o HEAD := arch/mips/kernel/head.o arch/mips/kernel/init_task.o
......
...@@ -7,6 +7,6 @@ ...@@ -7,6 +7,6 @@
# #
ramdisk.o: ramdisk.gz ld.script ramdisk.o: ramdisk.gz ld.script
$(LD) -T ld.script -b binary -o $@ ramdisk.gz $(LD) $(LDFLAGS) -T ld.script -b binary -o $@ ramdisk.gz
include $(TOPDIR)/Rules.make include $(TOPDIR)/Rules.make
...@@ -35,7 +35,7 @@ endif ...@@ -35,7 +35,7 @@ endif
# #
CFLAGS += -I $(TOPDIR)/include/asm/gcc $(CFLAGS) CFLAGS += -I $(TOPDIR)/include/asm/gcc $(CFLAGS)
CFLAGS += -mabi=64 -G 0 -mno-abicalls -fno-pic -Wa,--trap -pipe CFLAGS += -mabi=64 -G 0 -mno-abicalls -fno-pic -Wa,--trap -pipe
LINKFLAGS += -G 0 -static # -N LDFLAGS_vmlinux += -G 0 -static # -N
MODFLAGS += -mlong-calls MODFLAGS += -mlong-calls
ifdef CONFIG_REMOTE_DEBUG ifdef CONFIG_REMOTE_DEBUG
...@@ -118,7 +118,7 @@ endif ...@@ -118,7 +118,7 @@ endif
# #
ifdef CONFIG_BOOT_ELF32 ifdef CONFIG_BOOT_ELF32
CFLAGS += -Wa,-32 CFLAGS += -Wa,-32
LINKFLAGS += -T arch/mips64/ld.script.elf32 LDFLAGS_vmlinux += -T arch/mips64/ld.script.elf32
endif endif
# #
# The 64-bit ELF tools are pretty broken so at this time we generate 64-bit # The 64-bit ELF tools are pretty broken so at this time we generate 64-bit
...@@ -126,13 +126,13 @@ endif ...@@ -126,13 +126,13 @@ endif
# #
ifdef CONFIG_BOOT_ELF64 ifdef CONFIG_BOOT_ELF64
CFLAGS += -Wa,-32 CFLAGS += -Wa,-32
LINKFLAGS += -T arch/mips64/ld.script.elf32 LDFLAGS_vmlinux += -T arch/mips64/ld.script.elf32
#AS += -64 #AS += -64
#LD += -m elf64bmip #LDFLAGS += -m elf64bmip
#LINKFLAGS += -T arch/mips64/ld.script.elf64 #LDFLAGS_vmlinux += -T arch/mips64/ld.script.elf64
endif endif
LINKFLAGS += -Ttext $(LOADADDR) LDFLAGS_vmlinux += -Ttext $(LOADADDR)
HEAD := arch/mips64/kernel/head.o arch/mips64/kernel/init_task.o HEAD := arch/mips64/kernel/head.o arch/mips64/kernel/init_task.o
......
...@@ -20,9 +20,8 @@ ...@@ -20,9 +20,8 @@
FINAL_LD=$(CROSS_COMPILE)ld --warn-common --warn-section-align FINAL_LD=$(CROSS_COMPILE)ld --warn-common --warn-section-align
CPP=$(CC) -E CPP=$(CC) -E
OBJCOPY=$(CROSS_COMPILE)objcopy -O binary -R .note -R .comment -S OBJCOPY_FLAGS =-O binary -R .note -R .comment -S
LDFLAGS = LDFLAGS_vmlinux =-T arch/parisc/vmlinux.lds
LINKFLAGS =-T $(TOPDIR)/arch/parisc/vmlinux.lds $(LDFLAGS)
CFLAGS_PIPE := -pipe CFLAGS_PIPE := -pipe
CFLAGS_NSR := -fno-strength-reduce CFLAGS_NSR := -fno-strength-reduce
......
...@@ -21,7 +21,7 @@ else ...@@ -21,7 +21,7 @@ else
KERNELLOAD =0xc0000000 KERNELLOAD =0xc0000000
endif endif
LINKFLAGS = -T arch/ppc/vmlinux.lds -Ttext $(KERNELLOAD) -Bstatic LDFLAGS_vmlinux = -T arch/ppc/vmlinux.lds -Ttext $(KERNELLOAD) -Bstatic
CPPFLAGS := $(CPPFLAGS) -I$(TOPDIR)/arch/$(ARCH) CPPFLAGS := $(CPPFLAGS) -I$(TOPDIR)/arch/$(ARCH)
AFLAGS := $(AFLAGS) -I$(TOPDIR)/arch/$(ARCH) AFLAGS := $(AFLAGS) -I$(TOPDIR)/arch/$(ARCH)
CFLAGS := $(CFLAGS) -I$(TOPDIR)/arch/$(ARCH) -fsigned-char \ CFLAGS := $(CFLAGS) -I$(TOPDIR)/arch/$(ARCH) -fsigned-char \
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
KERNELLOAD =0xc000000000000000 KERNELLOAD =0xc000000000000000
LINKFLAGS = -T arch/ppc64/vmlinux.lds -Bstatic \ LDFLAGS_vmlinux = -T arch/ppc64/vmlinux.lds -Bstatic \
-e $(KERNELLOAD) -Ttext $(KERNELLOAD) -e $(KERNELLOAD) -Ttext $(KERNELLOAD)
CFLAGS := $(CFLAGS) -fsigned-char -msoft-float -pipe \ CFLAGS := $(CFLAGS) -fsigned-char -msoft-float -pipe \
-Wno-uninitialized -mminimal-toc -mtraceback=full \ -Wno-uninitialized -mminimal-toc -mtraceback=full \
......
...@@ -36,6 +36,7 @@ BOOTAFLAGS = -D__ASSEMBLY__ $(HOSTCFLAGS) ...@@ -36,6 +36,7 @@ BOOTAFLAGS = -D__ASSEMBLY__ $(HOSTCFLAGS)
CFLAGS = $(CPPFLAGS) -O -fno-builtin -DSTDC_HEADERS CFLAGS = $(CPPFLAGS) -O -fno-builtin -DSTDC_HEADERS
LD_ARGS = -Ttext 0x00400000 -e _start LD_ARGS = -Ttext 0x00400000 -e _start
OBJCOPYFLAGS := -S -O binary
OBJS = crt0.o start.o main.o zlib.o image.o imagesize.o OBJS = crt0.o start.o main.o zlib.o image.o imagesize.o
#LIBS = $(TOPDIR)/lib/lib.a #LIBS = $(TOPDIR)/lib/lib.a
...@@ -109,9 +110,8 @@ zImage.initrd: $(OBJS) initrd.o addnote ...@@ -109,9 +110,8 @@ zImage.initrd: $(OBJS) initrd.o addnote
$(BOOTLD) $(LD_ARGS) -T zImage.lds -o $@ $(OBJS) initrd.o $(LIBS) $(BOOTLD) $(LD_ARGS) -T zImage.lds -o $@ $(OBJS) initrd.o $(LIBS)
./addnote $@ ./addnote $@
vmlinux.gz: $(TOPDIR)/vmlinux vmlinux.gz: $(TOPDIR)/vmlinux
$(OBJCOPY) -S -O binary $(TOPDIR)/vmlinux vmlinux $(OBJCOPY) $(OBJCOPYFLAGS) $(TOPDIR)/vmlinux vmlinux
ls -l vmlinux | awk '{printf "/* generated -- do not edit! */\nint uncompressed_size = %d;\n", $$5}' > imagesize.c ls -l vmlinux | awk '{printf "/* generated -- do not edit! */\nint uncompressed_size = %d;\n", $$5}' > imagesize.c
$(CROSS_COMPILE)nm -n $(TOPDIR)/vmlinux | tail -1 | awk '{printf "long vmlinux_end = 0x%s;\n", substr($$1,8)}' >> imagesize.c $(CROSS_COMPILE)nm -n $(TOPDIR)/vmlinux | tail -1 | awk '{printf "long vmlinux_end = 0x%s;\n", substr($$1,8)}' >> imagesize.c
gzip -vf9 vmlinux gzip -vf9 vmlinux
......
...@@ -13,15 +13,14 @@ ...@@ -13,15 +13,14 @@
# Copyright (C) 1994 by Linus Torvalds # Copyright (C) 1994 by Linus Torvalds
# #
LD=$(CROSS_COMPILE)ld -m elf_s390 LDFLAGS := -m elf_s390
OBJCOPY=$(CROSS_COMPILE)objcopy -O binary -R .note -R .comment -S OBJCOPYFLAGS := -O binary
LDFLAGS=-e start
ifeq ($(CONFIG_SHARED_KERNEL),y) ifeq ($(CONFIG_SHARED_KERNEL),y)
LINKSCRIPT := arch/s390/vmlinux-shared.lds LINKSCRIPT := arch/s390/vmlinux-shared.lds
else else
LINKSCRIPT := arch/s390/vmlinux.lds LINKSCRIPT := arch/s390/vmlinux.lds
endif endif
LINKFLAGS =-T $(TOPDIR)/$(LINKSCRIPT) $(LDFLAGS) LDFLAGS_vmlinux := -T $(LINKSCRIPT) -e start
CFLAGS_PIPE := -pipe CFLAGS_PIPE := -pipe
CFLAGS_NSR := -fno-strength-reduce CFLAGS_NSR := -fno-strength-reduce
......
...@@ -2,21 +2,19 @@ ...@@ -2,21 +2,19 @@
# arch/s390/boot/Makefile # arch/s390/boot/Makefile
# #
OBJCOPY = $(CROSS_COMPILE)objcopy
EXTRA_AFLAGS := -traditional EXTRA_AFLAGS := -traditional
include $(TOPDIR)/Rules.make include $(TOPDIR)/Rules.make
%.lnk: %.o %.lnk: %.o
$(LD) -Ttext 0x0 -o $@ $< $(LD) $(LDFLAGS) -Ttext 0x0 -o $@ $<
%.boot: %.lnk %.boot: %.lnk
$(OBJCOPY) -O binary $< $@ $(OBJCOPY) $(OBJCOPYFLAGS) $< $@
image: $(TOPDIR)/vmlinux \ image: $(TOPDIR)/vmlinux \
iplfba.boot ipleckd.boot ipldump.boot iplfba.boot ipleckd.boot ipldump.boot
$(OBJCOPY) -O binary $(TOPDIR)/vmlinux image $(OBJCOPY) $(OBJCOPYFLAGS) $(TOPDIR)/vmlinux image
$(NM) $(TOPDIR)/vmlinux | grep -v '\(compiled\)\|\( [aUw] \)\|\(\.\)\|\(LASH[RL]DI\)' | sort > $(TOPDIR)/System.map $(NM) $(TOPDIR)/vmlinux | grep -v '\(compiled\)\|\( [aUw] \)\|\(\.\)\|\(LASH[RL]DI\)' | sort > $(TOPDIR)/System.map
listing: ../../../vmlinux listing: ../../../vmlinux
......
...@@ -13,16 +13,15 @@ ...@@ -13,16 +13,15 @@
# Copyright (C) 1994 by Linus Torvalds # Copyright (C) 1994 by Linus Torvalds
# #
LD=$(CROSS_COMPILE)ld -m elf64_s390 LDFLAGS := -m elf64_s390
CPP=$(CC) -E CPP=$(CC) -E
OBJCOPY=$(CROSS_COMPILE)objcopy -O binary -R .note -R .comment -S OBJCOPYFLAGS := -O binary
LDFLAGS=-e start
ifeq ($(CONFIG_SHARED_KERNEL),y) ifeq ($(CONFIG_SHARED_KERNEL),y)
LINKSCRIPT := arch/s390x/vmlinux-shared.lds LINKSCRIPT := arch/s390x/vmlinux-shared.lds
else else
LINKSCRIPT := arch/s390x/vmlinux.lds LINKSCRIPT := arch/s390x/vmlinux.lds
endif endif
LINKFLAGS =-T $(TOPDIR)/$(LINKSCRIPT) $(LDFLAGS) LDFLAGS_vmlinux := -T $(LINKSCRIPT) -e start
MODFLAGS += -fpic MODFLAGS += -fpic
CFLAGS_PIPE := -pipe CFLAGS_PIPE := -pipe
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
# Makefile for the linux s390-specific parts of the memory manager. # Makefile for the linux s390-specific parts of the memory manager.
# #
OBJCOPY = $(CROSS_COMPILE)objcopy
O_TARGET := O_TARGET :=
EXTRA_AFLAGS := -traditional EXTRA_AFLAGS := -traditional
...@@ -14,11 +12,11 @@ include $(TOPDIR)/Rules.make ...@@ -14,11 +12,11 @@ include $(TOPDIR)/Rules.make
$(LD) -Ttext 0x0 -o $@ $< $(LD) -Ttext 0x0 -o $@ $<
%.boot: %.lnk %.boot: %.lnk
$(OBJCOPY) -O binary $< $@ $(OBJCOPY) $(OBJCOPYFLAGS) $< $@
image: $(TOPDIR)/vmlinux \ image: $(TOPDIR)/vmlinux \
iplfba.boot ipleckd.boot ipldump.boot iplfba.boot ipleckd.boot ipldump.boot
$(OBJCOPY) -O binary $(TOPDIR)/vmlinux image $(OBJCOPY) $(OBJCOPYFLAGS) $< $@
$(NM) $(TOPDIR)/vmlinux | grep -v '\(compiled\)\|\( [aUw] \)\|\(\.\)\|\(LASH[RL]DI\)' | sort > $(TOPDIR)/System.map $(NM) $(TOPDIR)/vmlinux | grep -v '\(compiled\)\|\( [aUw] \)\|\(\.\)\|\(LASH[RL]DI\)' | sort > $(TOPDIR)/System.map
listing: ../../../vmlinux listing: ../../../vmlinux
......
...@@ -15,17 +15,16 @@ ...@@ -15,17 +15,16 @@
ifdef CONFIG_CPU_LITTLE_ENDIAN ifdef CONFIG_CPU_LITTLE_ENDIAN
CFLAGS += -ml CFLAGS += -ml
AFLAGS += -ml AFLAGS += -ml
# LINKFLAGS += -EL # LDFLAGS_vmlinux += -EL
LDFLAGS := -EL LDFLAGS := -EL
else else
CFLAGS += -mb CFLAGS += -mb
AFLAGS += -mb AFLAGS += -mb
# LINKFLAGS += -EB # LDFLAGS_vmlinux += -EB
LDFLAGS := -EB LDFLAGS := -EB
endif endif
LD =$(CROSS_COMPILE)ld $(LDFLAGS) OBJCOPYFLAGS := -O binary -R .note -R .comment -R .stab -R .stabstr -S
OBJCOPY=$(CROSS_COMPILE)objcopy -O binary -R .note -R .comment -R .stab -R .stabstr -S
MODFLAGS += MODFLAGS +=
...@@ -47,10 +46,10 @@ endif ...@@ -47,10 +46,10 @@ endif
# none has been choosen above. # none has been choosen above.
# #
LINKSCRIPT = arch/sh/vmlinux.lds LINKSCRIPT = arch/sh/vmlinux.lds
LINKFLAGS += -T $(word 1,$(LINKSCRIPT)) -e _stext LDFLAGS_vmlinux += -T $(word 1,$(LINKSCRIPT)) -e _stext
ifdef LOADADDR ifdef LOADADDR
LINKFLAGS += -Ttext $(word 1,$(LOADADDR)) LDFLAGS_vmlinux += -Ttext $(word 1,$(LOADADDR))
endif endif
# #
......
...@@ -11,10 +11,10 @@ ...@@ -11,10 +11,10 @@
SYSTEM =$(TOPDIR)/vmlinux SYSTEM =$(TOPDIR)/vmlinux
Image: $(SYSTEM) Image: $(SYSTEM)
$(OBJCOPY) $(SYSTEM) Image $(OBJCOPY) $(OBJCOPYFLAGS) $< $@
zImage: compressed/vmlinux zImage: compressed/vmlinux
$(OBJCOPY) compressed/vmlinux zImage $(OBJCOPY) $(OBJCOPYFLAGS) $< $@
compressed/vmlinux: $(TOPDIR)/vmlinux compressed/vmlinux: $(TOPDIR)/vmlinux
$(MAKE) -C compressed vmlinux $(MAKE) -C compressed vmlinux
......
...@@ -25,7 +25,7 @@ ZLINKFLAGS = -Ttext $(ZIMAGE_OFFSET) $(ZLDFLAGS) ...@@ -25,7 +25,7 @@ ZLINKFLAGS = -Ttext $(ZIMAGE_OFFSET) $(ZLDFLAGS)
all: vmlinux all: vmlinux
vmlinux: piggy.o $(OBJECTS) vmlinux: piggy.o $(OBJECTS)
$(LD) $(ZLINKFLAGS) -o vmlinux $(OBJECTS) piggy.o $(LD) $(LDFLAGS) $(ZLINKFLAGS) -o vmlinux $(OBJECTS) piggy.o
head.o: head.S head.o: head.S
$(CC) $(AFLAGS) -traditional -c head.S $(CC) $(AFLAGS) -traditional -c head.S
...@@ -33,10 +33,10 @@ head.o: head.S ...@@ -33,10 +33,10 @@ head.o: head.S
piggy.o: $(SYSTEM) piggy.o: $(SYSTEM)
tmppiggy=_tmp_$$$$piggy; \ tmppiggy=_tmp_$$$$piggy; \
rm -f $$tmppiggy $$tmppiggy.gz $$tmppiggy.lnk; \ rm -f $$tmppiggy $$tmppiggy.gz $$tmppiggy.lnk; \
$(OBJCOPY) -R .empty_zero_page $(SYSTEM) $$tmppiggy; \ $(OBJCOPY) $(OBJCOPYFLAGS) -R .empty_zero_page $(SYSTEM) $$tmppiggy; \
gzip -f -9 < $$tmppiggy > $$tmppiggy.gz; \ gzip -f -9 < $$tmppiggy > $$tmppiggy.gz; \
echo "SECTIONS { .data : { input_len = .; LONG(input_data_end - input_data) input_data = .; *(.data) input_data_end = .; }}" > $$tmppiggy.lnk; \ echo "SECTIONS { .data : { input_len = .; LONG(input_data_end - input_data) input_data = .; *(.data) input_data_end = .; }}" > $$tmppiggy.lnk; \
$(LD) -r -o piggy.o -b binary $$tmppiggy.gz -b elf32-sh-linux -T $$tmppiggy.lnk; \ $(LD) $(LDFLAGS) -r -o piggy.o -b binary $$tmppiggy.gz -b elf32-sh-linux -T $$tmppiggy.lnk; \
rm -f $$tmppiggy $$tmppiggy.gz $$tmppiggy.lnk rm -f $$tmppiggy $$tmppiggy.gz $$tmppiggy.lnk
clean: clean:
......
...@@ -20,7 +20,7 @@ NEW_GAS := $(shell if $(LD) --version 2>&1 | grep 'elf64_sparc' > /dev/null; the ...@@ -20,7 +20,7 @@ NEW_GAS := $(shell if $(LD) --version 2>&1 | grep 'elf64_sparc' > /dev/null; the
ifeq ($(NEW_GAS),y) ifeq ($(NEW_GAS),y)
AS := $(AS) -32 AS := $(AS) -32
LD := $(LD) -m elf32_sparc LDFLAGS := -m elf32_sparc
endif endif
#CFLAGS := $(CFLAGS) -g -pipe -fcall-used-g5 -fcall-used-g7 #CFLAGS := $(CFLAGS) -g -pipe -fcall-used-g5 -fcall-used-g7
...@@ -30,8 +30,8 @@ else ...@@ -30,8 +30,8 @@ else
CFLAGS := $(CFLAGS) -m32 -pipe -mno-fpu -fcall-used-g5 -fcall-used-g7 CFLAGS := $(CFLAGS) -m32 -pipe -mno-fpu -fcall-used-g5 -fcall-used-g7
endif endif
#LINKFLAGS = -N -Ttext 0xf0004000 #LDFLAGS_vmlinux = -N -Ttext 0xf0004000
LINKFLAGS = -T arch/sparc/vmlinux.lds LDFLAGS_vmlinux = -T arch/sparc/vmlinux.lds
HEAD := arch/sparc/kernel/head.o arch/sparc/kernel/init_task.o HEAD := arch/sparc/kernel/head.o arch/sparc/kernel/init_task.o
......
...@@ -31,7 +31,7 @@ BTLIBS := $(CORE_FILES_NO_BTFIX) $(FILESYSTEMS) \ ...@@ -31,7 +31,7 @@ BTLIBS := $(CORE_FILES_NO_BTFIX) $(FILESYSTEMS) \
# properly as it will cause head.o to be built with the implicit # properly as it will cause head.o to be built with the implicit
# rules not the ones in kernel/Makefile. Someone please fix. --DaveM # rules not the ones in kernel/Makefile. Someone please fix. --DaveM
vmlinux.o: FORCE vmlinux.o: FORCE
$(LD) -r $(patsubst %,$(TOPDIR)/%,$(BTOBJS)) \ $(LD) $(LDFLAGS) -r $(patsubst %,$(TOPDIR)/%,$(BTOBJS)) \
--start-group \ --start-group \
$(patsubst %,$(TOPDIR)/%,$(BTLIBS)) \ $(patsubst %,$(TOPDIR)/%,$(BTLIBS)) \
$(LIBS) \ $(LIBS) \
......
...@@ -28,7 +28,7 @@ AR = sparc64-linux-ar ...@@ -28,7 +28,7 @@ AR = sparc64-linux-ar
RANLIB = sparc64-linux-ranlib RANLIB = sparc64-linux-ranlib
else else
AS := $(AS) -64 AS := $(AS) -64
LD := $(LD) -m elf64_sparc LDFLAGS := -m elf64_sparc
endif endif
ELFTOAOUT = elftoaout ELFTOAOUT = elftoaout
ifneq ($(UNDECLARED_REGS),y) ifneq ($(UNDECLARED_REGS),y)
...@@ -53,7 +53,7 @@ ifeq ($(CONFIG_MCOUNT),y) ...@@ -53,7 +53,7 @@ ifeq ($(CONFIG_MCOUNT),y)
CFLAGS := $(CFLAGS) -pg CFLAGS := $(CFLAGS) -pg
endif endif
LINKFLAGS = -T arch/sparc64/vmlinux.lds LDFLAGS_vmlinux = -T arch/sparc64/vmlinux.lds
HEAD := arch/sparc64/kernel/head.o arch/sparc64/kernel/init_task.o HEAD := arch/sparc64/kernel/head.o arch/sparc64/kernel/init_task.o
......
...@@ -34,9 +34,8 @@ export IA32_CC IA32_LD IA32_AS IA32_OBJCOPY IA32_CPP ...@@ -34,9 +34,8 @@ export IA32_CC IA32_LD IA32_AS IA32_OBJCOPY IA32_CPP
LD=$(CROSS_COMPILE)ld -m elf_x86_64 LD=$(CROSS_COMPILE)ld -m elf_x86_64
OBJCOPY=$(CROSS_COMPILE)objcopy -O binary -R .note -R .comment -S OBJCOPYFLAGS := -O binary -R .note -R .comment -S
LDFLAGS=-e stext LDFLAGS_vmlinux := -T arch/x86_64/vmlinux.lds -e stext
LINKFLAGS =-T $(TOPDIR)/arch/x86_64/vmlinux.lds $(LDFLAGS)
CFLAGS += -mno-red-zone CFLAGS += -mno-red-zone
CFLAGS += -mcmodel=kernel CFLAGS += -mcmodel=kernel
......
...@@ -28,11 +28,11 @@ BOOT_INCL = $(TOPDIR)/include/linux/config.h \ ...@@ -28,11 +28,11 @@ BOOT_INCL = $(TOPDIR)/include/linux/config.h \
$(TOPDIR)/include/asm/boot.h $(TOPDIR)/include/asm/boot.h
zImage: bootsect setup compressed/vmlinux tools/build zImage: bootsect setup compressed/vmlinux tools/build
$(OBJCOPY) compressed/vmlinux compressed/vmlinux.out $(OBJCOPY) $(OBJCOPYFLAGS) compressed/vmlinux compressed/vmlinux.out
tools/build bootsect setup compressed/vmlinux.out $(ROOT_DEV) > zImage tools/build bootsect setup compressed/vmlinux.out $(ROOT_DEV) > zImage
bzImage: bbootsect bsetup compressed/bvmlinux tools/build bzImage: bbootsect bsetup compressed/bvmlinux tools/build
$(OBJCOPY) compressed/bvmlinux compressed/bvmlinux.out $(OBJCOPY) $(OBJCOPYFLAGS) compressed/bvmlinux compressed/bvmlinux.out
tools/build -b bbootsect bsetup compressed/bvmlinux.out $(ROOT_DEV) > bzImage tools/build -b bbootsect bsetup compressed/bvmlinux.out $(ROOT_DEV) > bzImage
bzImage-padded: bzImage bzImage-padded: bzImage
......
...@@ -33,7 +33,7 @@ misc.o: misc.c ...@@ -33,7 +33,7 @@ misc.o: misc.c
piggy.o: $(SYSTEM) piggy.o: $(SYSTEM)
tmppiggy=_tmp_$$$$piggy; \ tmppiggy=_tmp_$$$$piggy; \
rm -f $$tmppiggy $$tmppiggy.gz $$tmppiggy.lnk; \ rm -f $$tmppiggy $$tmppiggy.gz $$tmppiggy.lnk; \
$(OBJCOPY) $(SYSTEM) $$tmppiggy; \ $(OBJCOPY) $(OBJCOPYFLAGS) $< $$tmppiggy; \
gzip -f -9 < $$tmppiggy > $$tmppiggy.gz; \ gzip -f -9 < $$tmppiggy > $$tmppiggy.gz; \
echo "SECTIONS { .data : { input_len = .; LONG(input_data_end - input_data) input_data = .; *(.data) input_data_end = .; }}" > $$tmppiggy.lnk; \ echo "SECTIONS { .data : { input_len = .; LONG(input_data_end - input_data) input_data = .; *(.data) input_data_end = .; }}" > $$tmppiggy.lnk; \
$(IA32_LD) -r -o piggy.o -b binary $$tmppiggy.gz -b elf32-i386 -T $$tmppiggy.lnk; \ $(IA32_LD) -r -o piggy.o -b binary $$tmppiggy.gz -b elf32-i386 -T $$tmppiggy.lnk; \
......
...@@ -20,5 +20,16 @@ obj-y += $(obj-$(MACHINE)) ...@@ -20,5 +20,16 @@ obj-y += $(obj-$(MACHINE))
include $(TOPDIR)/Rules.make include $(TOPDIR)/Rules.make
$(obj)/%.c: $(src)/%.map $(obj)/defkeymap-acorn.o: $(obj)/defkeymap-acorn.c
# Uncomment if you're changing the keymap and have an appropriate
# loadkeys version for the map. By default, we'll use the shipped
# versions.
# GENERATE_KEYMAP := 1
ifdef GENERATE_KEYMAP
$(obj)/defkeymap-acorn.c: $(obj)/%.c: $(src)/%.map
loadkeys --mktable $< > $@ loadkeys --mktable $< > $@
endif
...@@ -219,8 +219,20 @@ include $(TOPDIR)/Rules.make ...@@ -219,8 +219,20 @@ include $(TOPDIR)/Rules.make
$(obj)/consolemap_deftbl.c: $(src)/$(FONTMAPFILE) $(obj)/conmakehash $(obj)/consolemap_deftbl.c: $(src)/$(FONTMAPFILE) $(obj)/conmakehash
$(obj)/conmakehash $< > $@ $(obj)/conmakehash $< > $@
$(obj)/defkeymap.c: $(src)/defkeymap.map $(obj)/defkeymap.o: $(obj)/defkeymap.c
set -e ; loadkeys --mktable $< | sed -e 's/^static *//' > $@
$(obj)/qtronixmap.c: $(src)/qtronixmap.map $(obj)/qtronixmap.o: $(obj)/qtronixmap.c
set -e ; loadkeys --mktable $< | sed -e 's/^static *//' > $@
# Uncomment if you're changing the keymap and have an appropriate
# loadkeys version for the map. By default, we'll use the shipped
# versions.
# GENERATE_KEYMAP := 1
ifdef GENERATE_KEYMAP
$(obj)/defkeymap.c $(obj)/qtronixmap.c: $(obj)/%.c: $(src)/%.map
loadkeys --mktable $< > $@.tmp
sed -e 's/^static *//' $@.tmp > $@
rm $@.tmp
endif
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
...@@ -1173,18 +1173,6 @@ static void channel_init(struct ata_channel *ch) ...@@ -1173,18 +1173,6 @@ static void channel_init(struct ata_channel *ch)
gd->next = NULL; /* linked list of major devs */ gd->next = NULL; /* linked list of major devs */
gd->fops = ide_fops; /* file operations */ gd->fops = ide_fops; /* file operations */
gd->de_arr = kmalloc(sizeof(*gd->de_arr) * MAX_DRIVES, GFP_KERNEL);
if (gd->de_arr)
memset(gd->de_arr, 0, sizeof(*gd->de_arr) * MAX_DRIVES);
else
goto err_kmalloc_gd_de_arr;
gd->flags = kmalloc(sizeof(*gd->flags) * MAX_DRIVES, GFP_KERNEL);
if (gd->flags)
memset(gd->flags, 0, sizeof(*gd->flags) * MAX_DRIVES);
else
goto err_kmalloc_gd_flags;
ch->gd = gd; ch->gd = gd;
add_gendisk(gd); add_gendisk(gd);
......
...@@ -64,6 +64,18 @@ CONFIG_INPUT_JOYDEV ...@@ -64,6 +64,18 @@ CONFIG_INPUT_JOYDEV
The module will be called joydev.o. If you want to compile it as a The module will be called joydev.o. If you want to compile it as a
module, say M here and read <file:Documentation/modules.txt>. module, say M here and read <file:Documentation/modules.txt>.
CONFIG_INPUT_TSDEV
Say Y here if you have an application that only can understand the
Compaq touchscreen protocol for absolute pointer data. This is
useful namely for embedded configurations.
If unsure, say N.
This driver is also available as a module ( = code which can be
inserted in and removed from the running kernel whenever you want).
The module will be called tsdev.o. If you want to compile it as a
module, say M here and read <file:Documentation/modules.txt>.
CONFIG_INPUT_EVDEV CONFIG_INPUT_EVDEV
Say Y here if you want your input device events be accessible Say Y here if you want your input device events be accessible
under char device 13:64+ - /dev/input/eventX in a generic way. under char device 13:64+ - /dev/input/eventX in a generic way.
...@@ -72,3 +84,17 @@ CONFIG_INPUT_EVDEV ...@@ -72,3 +84,17 @@ CONFIG_INPUT_EVDEV
inserted in and removed from the running kernel whenever you want). inserted in and removed from the running kernel whenever you want).
The module will be called evdev.o. If you want to compile it as a The module will be called evdev.o. If you want to compile it as a
module, say M here and read <file:Documentation/modules.txt>. module, say M here and read <file:Documentation/modules.txt>.
CONFIG_INPUT_EVBUG
Say Y here if you have a problem with the input subsystem and
want all events (keypresses, mouse movements), to be output to
the system log. While this is useful for debugging, it's also
a security threat - your keypresses include your passwords, of
course.
If unsure, say N.
This driver is also available as a module ( = code which can be
inserted in and removed from the running kernel whenever you want).
The module will be called joydev.o. If you want to compile it as a
module, say M here and read <file:Documentation/modules.txt>.
...@@ -6,20 +6,34 @@ mainmenu_option next_comment ...@@ -6,20 +6,34 @@ mainmenu_option next_comment
comment 'Input device support' comment 'Input device support'
tristate 'Input core support' CONFIG_INPUT tristate 'Input core support' CONFIG_INPUT
comment 'Userland interfaces'
dep_tristate ' Keyboard interface' CONFIG_INPUT_KEYBDEV $CONFIG_INPUT dep_tristate ' Keyboard interface' CONFIG_INPUT_KEYBDEV $CONFIG_INPUT
dep_tristate ' Mouse interface' CONFIG_INPUT_MOUSEDEV $CONFIG_INPUT dep_tristate ' Mouse interface' CONFIG_INPUT_MOUSEDEV $CONFIG_INPUT
dep_mbool ' Provide legacy /dev/psaux device' CONFIG_INPUT_MOUSEDEV_PSAUX $CONFIG_INPUT
if [ "$CONFIG_INPUT_MOUSEDEV" != "n" ]; then if [ "$CONFIG_INPUT_MOUSEDEV" != "n" ]; then
int ' Horizontal screen resolution' CONFIG_INPUT_MOUSEDEV_SCREEN_X 1024 int ' Horizontal screen resolution' CONFIG_INPUT_MOUSEDEV_SCREEN_X 1024
int ' Vertical screen resolution' CONFIG_INPUT_MOUSEDEV_SCREEN_Y 768 int ' Vertical screen resolution' CONFIG_INPUT_MOUSEDEV_SCREEN_Y 768
fi fi
dep_tristate ' Joystick interface' CONFIG_INPUT_JOYDEV $CONFIG_INPUT dep_tristate ' Joystick interface' CONFIG_INPUT_JOYDEV $CONFIG_INPUT
dep_tristate ' Touchscreen interface' CONFIG_INPUT_TSDEV $CONFIG_INPUT
if [ "$CONFIG_INPUT_TSDEV" != "n" ]; then
int ' Horizontal screen resolution' CONFIG_INPUT_TSDEV_SCREEN_X 240
int ' Vertical screen resolution' CONFIG_INPUT_TSDEV_SCREEN_Y 320
fi
dep_tristate ' Event interface' CONFIG_INPUT_EVDEV $CONFIG_INPUT dep_tristate ' Event interface' CONFIG_INPUT_EVDEV $CONFIG_INPUT
dep_tristate ' Event debugging' CONFIG_INPUT_EVBUG $CONFIG_INPUT
comment 'Input I/O drivers'
source drivers/input/gameport/Config.in source drivers/input/gameport/Config.in
source drivers/input/serio/Config.in source drivers/input/serio/Config.in
comment 'Input Device Drivers'
if [ "$CONFIG_INPUT" != "n" ]; then if [ "$CONFIG_INPUT" != "n" ]; then
source drivers/input/keyboard/Config.in
source drivers/input/mouse/Config.in
source drivers/input/joystick/Config.in source drivers/input/joystick/Config.in
source drivers/input/touchscreen/Config.in
fi fi
endmenu endmenu
...@@ -13,8 +13,14 @@ obj-$(CONFIG_INPUT_KEYBDEV) += keybdev.o ...@@ -13,8 +13,14 @@ obj-$(CONFIG_INPUT_KEYBDEV) += keybdev.o
obj-$(CONFIG_INPUT_MOUSEDEV) += mousedev.o obj-$(CONFIG_INPUT_MOUSEDEV) += mousedev.o
obj-$(CONFIG_INPUT_JOYDEV) += joydev.o obj-$(CONFIG_INPUT_JOYDEV) += joydev.o
obj-$(CONFIG_INPUT_EVDEV) += evdev.o obj-$(CONFIG_INPUT_EVDEV) += evdev.o
obj-$(CONFIG_INPUT_TSDEV) += tsdev.o
obj-$(CONFIG_INPUT_POWER) += power.o
obj-$(CONFIG_INPUT_EVBUG) += evbug.o
obj-$(CONFIG_INPUT_KEYBOARD) += keyboard/
obj-$(CONFIG_INPUT_MOUSE) += mouse/
obj-$(CONFIG_INPUT_JOYSTICK) += joystick/ obj-$(CONFIG_INPUT_JOYSTICK) += joystick/
obj-$(CONFIG_INPUT_TOUCHSCREEN) += touchscreen/
# The global Rules.make. # The global Rules.make.
......
/*
* $Id: evbug.c,v 1.10 2001/09/25 10:12:07 vojtech Exp $
*
* Copyright (c) 1999-2001 Vojtech Pavlik
*/
/*
* Input driver event debug module - dumps all events into syslog
*/
/*
* 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. 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Should you need to contact me, the author, you can do so either by
* e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
* Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
*/
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/input.h>
#include <linux/init.h>
MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
MODULE_DESCRIPTION("Input driver event debug module");
MODULE_LICENSE("GPL");
static void evbug_event(struct input_handle *handle, unsigned int type, unsigned int code, int value)
{
printk(KERN_DEBUG "evbug.c: Event. Dev: %s, Type: %d, Code: %d, Value: %d\n", handle->dev->phys, type, code, value);
}
static struct input_handle *evbug_connect(struct input_handler *handler, struct input_dev *dev, struct input_device_id *id)
{
struct input_handle *handle;
if (!(handle = kmalloc(sizeof(struct input_handle), GFP_KERNEL)))
return NULL;
memset(handle, 0, sizeof(struct input_handle));
handle->dev = dev;
handle->handler = handler;
input_open_device(handle);
printk(KERN_DEBUG "evbug.c: Connected device: \"%s\", %s\n", dev->name, dev->phys);
return handle;
}
static void evbug_disconnect(struct input_handle *handle)
{
printk(KERN_DEBUG "evbug.c: Disconnected device: %s\n", handle->dev->phys);
input_close_device(handle);
kfree(handle);
}
static struct input_device_id evbug_ids[] = {
{ driver_info: 1 }, /* Matches all devices */
{ }, /* Terminating zero entry */
};
MODULE_DEVICE_TABLE(input, evbug_ids);
static struct input_handler evbug_handler = {
event: evbug_event,
connect: evbug_connect,
disconnect: evbug_disconnect,
name: "evbug",
id_table: evbug_ids,
};
int __init evbug_init(void)
{
input_register_handler(&evbug_handler);
return 0;
}
void __exit evbug_exit(void)
{
input_unregister_handler(&evbug_handler);
}
module_init(evbug_init);
module_exit(evbug_exit);
/* /*
* $Id: evdev.c,v 1.42 2002/01/02 11:59:56 vojtech Exp $ * $Id: evdev.c,v 1.48 2002/05/26 14:28:26 jdeneux Exp $
* *
* Copyright (c) 1999-2001 Vojtech Pavlik * Copyright (c) 1999-2001 Vojtech Pavlik
* *
...@@ -40,7 +40,6 @@ ...@@ -40,7 +40,6 @@
struct evdev { struct evdev {
int exist; int exist;
int open; int open;
int open_for_write;
int minor; int minor;
char name[16]; char name[16];
struct input_handle handle; struct input_handle handle;
...@@ -91,7 +90,9 @@ static int evdev_fasync(int fd, struct file *file, int on) ...@@ -91,7 +90,9 @@ static int evdev_fasync(int fd, struct file *file, int on)
static int evdev_flush(struct file * file) static int evdev_flush(struct file * file)
{ {
return input_flush_device(&((struct evdev_list*)file->private_data)->evdev->handle, file); struct evdev_list *list = (struct evdev_list*)file->private_data;
if (!list->evdev->exist) return -ENODEV;
return input_flush_device(&list->evdev->handle, file);
} }
static int evdev_release(struct inode * inode, struct file * file) static int evdev_release(struct inode * inode, struct file * file)
...@@ -158,6 +159,8 @@ static ssize_t evdev_write(struct file * file, const char * buffer, size_t count ...@@ -158,6 +159,8 @@ static ssize_t evdev_write(struct file * file, const char * buffer, size_t count
struct input_event event; struct input_event event;
int retval = 0; int retval = 0;
if (!list->evdev->exist) return -ENODEV;
while (retval < count) { while (retval < count) {
if (copy_from_user(&event, buffer + retval, sizeof(struct input_event))) if (copy_from_user(&event, buffer + retval, sizeof(struct input_event)))
...@@ -232,6 +235,8 @@ static int evdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd, ...@@ -232,6 +235,8 @@ static int evdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
struct input_dev *dev = evdev->handle.dev; struct input_dev *dev = evdev->handle.dev;
int retval, t, u; int retval, t, u;
if (!evdev->exist) return -ENODEV;
switch (cmd) { switch (cmd) {
case EVIOCGVERSION: case EVIOCGVERSION:
...@@ -284,11 +289,11 @@ static int evdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd, ...@@ -284,11 +289,11 @@ static int evdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
int err; int err;
if (copy_from_user((void*)(&effect), (void*)arg, sizeof(effect))) { if (copy_from_user((void*)(&effect), (void*)arg, sizeof(effect))) {
return -EINVAL; return -EFAULT;
} }
err = dev->upload_effect(dev, &effect); err = dev->upload_effect(dev, &effect);
if (put_user(effect.id, &(((struct ff_effect*)arg)->id))) { if (put_user(effect.id, &(((struct ff_effect*)arg)->id))) {
return -EINVAL; return -EFAULT;
} }
return err; return err;
} }
...@@ -301,7 +306,8 @@ static int evdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd, ...@@ -301,7 +306,8 @@ static int evdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
else return -ENOSYS; else return -ENOSYS;
case EVIOCGEFFECTS: case EVIOCGEFFECTS:
put_user(dev->ff_effects_max, (int*) arg); if ((retval = put_user(dev->ff_effects_max, (int*) arg)))
return retval;
return 0; return 0;
default: default:
......
...@@ -34,7 +34,7 @@ CONFIG_GAMEPORT_L4 ...@@ -34,7 +34,7 @@ CONFIG_GAMEPORT_L4
The module will be called lightning.o. If you want to compile it as The module will be called lightning.o. If you want to compile it as
a module, say M here and read <file:Documentation/modules.txt>. a module, say M here and read <file:Documentation/modules.txt>.
CONFIG_GAMEPORT_EMU10K1 CONFIG_INPUT_EMU10K1
Say Y here if you have a SoundBlaster Live! or SoundBlaster Say Y here if you have a SoundBlaster Live! or SoundBlaster
Audigy card and want to use its gameport. Audigy card and want to use its gameport.
...@@ -43,16 +43,16 @@ CONFIG_GAMEPORT_EMU10K1 ...@@ -43,16 +43,16 @@ CONFIG_GAMEPORT_EMU10K1
The module will be called emu10k1-gp.o. If you want to compile it as The module will be called emu10k1-gp.o. If you want to compile it as
a module, say M here and read <file:Documentation/modules.txt>. a module, say M here and read <file:Documentation/modules.txt>.
CONFIG_GAMEPORT_PCIGAME CONFIG_GAMEPORT_VORTEX
Say Y here if you have an Aureal Vortex 1 or 2 or a Trident Say Y here if you have an Aureal Vortex 1 or 2 card and want
4DWave NX or DX card and want to use its gameport. to use its gameport.
This driver is also available as a module ( = code which can be This driver is also available as a module ( = code which can be
inserted in and removed from the running kernel whenever you want). inserted in and removed from the running kernel whenever you want).
The module will be called pcigame.o. If you want to compile it as a The module will be called vortex.o. If you want to compile it as a
module, say M here and read <file:Documentation/modules.txt>. module, say M here and read <file:Documentation/modules.txt>.
CONFIG_GAMEPORT_CS461X CONFIG_GAMEPORT_CS461x
Say Y here if you have a Cirrus CS461x aka "Crystal SoundFusion" Say Y here if you have a Cirrus CS461x aka "Crystal SoundFusion"
PCI audio accelerator and want to use its gameport. PCI audio accelerator and want to use its gameport.
......
...@@ -14,6 +14,6 @@ fi ...@@ -14,6 +14,6 @@ fi
dep_tristate ' Classic ISA and PnP gameport support' CONFIG_GAMEPORT_NS558 $CONFIG_GAMEPORT dep_tristate ' Classic ISA and PnP gameport support' CONFIG_GAMEPORT_NS558 $CONFIG_GAMEPORT
dep_tristate ' PDPI Lightning 4 gamecard support' CONFIG_GAMEPORT_L4 $CONFIG_GAMEPORT dep_tristate ' PDPI Lightning 4 gamecard support' CONFIG_GAMEPORT_L4 $CONFIG_GAMEPORT
dep_tristate ' SB Live and Audigy gameport support' CONFIG_INPUT_EMU10K1 $CONFIG_GAMEPORT dep_tristate ' SB Live and Audigy gameport support' CONFIG_INPUT_EMU10K1 $CONFIG_GAMEPORT
dep_tristate ' Aureal Vortex, Vortex 2 and Trident 4DWave NX/DX gameport support' CONFIG_GAMEPORT_PCIGAME $CONFIG_GAMEPORT dep_tristate ' Aureal Vortex, Vortex 2 gameport support' CONFIG_GAMEPORT_VORTEX $CONFIG_GAMEPORT
dep_tristate ' ForteMedia FM801 gameport support' CONFIG_GAMEPORT_FM801 $CONFIG_GAMEPORT dep_tristate ' ForteMedia FM801 gameport support' CONFIG_GAMEPORT_FM801 $CONFIG_GAMEPORT
dep_tristate ' Crystal SoundFusion gameport support' CONFIG_GAMEPORT_CS461x $CONFIG_GAMEPORT dep_tristate ' Crystal SoundFusion gameport support' CONFIG_GAMEPORT_CS461x $CONFIG_GAMEPORT
...@@ -11,9 +11,10 @@ export-objs := gameport.o ...@@ -11,9 +11,10 @@ export-objs := gameport.o
obj-$(CONFIG_GAMEPORT) += gameport.o obj-$(CONFIG_GAMEPORT) += gameport.o
obj-$(CONFIG_GAMEPORT_CS461X) += cs461x.o obj-$(CONFIG_GAMEPORT_CS461X) += cs461x.o
obj-$(CONFIG_GAMEPORT_EMU10K1) += emu10k1-gp.o obj-$(CONFIG_GAMEPORT_EMU10K1) += emu10k1-gp.o
obj-$(CONFIG_GAMEPORT_FM801) += fm801-gp.o
obj-$(CONFIG_GAMEPORT_L4) += lightning.o obj-$(CONFIG_GAMEPORT_L4) += lightning.o
obj-$(CONFIG_GAMEPORT_NS558) += ns558.o obj-$(CONFIG_GAMEPORT_NS558) += ns558.o
obj-$(CONFIG_GAMEPORT_PCIGAME) += pcigame.o obj-$(CONFIG_GAMEPORT_VORTEX) += vortex.o
# The global Rules.make. # The global Rules.make.
......
/*
* FM801 gameport driver for Linux
*
* Copyright (c) by Takashi Iwai <tiwai@suse.de>
*
*
* 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. 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.
*
*/
#include <asm/io.h>
#include <linux/delay.h>
#include <linux/errno.h>
#include <linux/ioport.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/gameport.h>
#define PCI_VENDOR_ID_FORTEMEDIA 0x1319
#define PCI_DEVICE_ID_FM801_GP 0x0802
#define HAVE_COOKED
struct fm801_gp {
struct gameport gameport;
struct resource *res_port;
char phys[32];
char name[32];
};
#ifdef HAVE_COOKED
static int fm801_gp_cooked_read(struct gameport *gameport, int *axes, int *buttons)
{
unsigned short w;
w = inw(gameport->io + 2);
*buttons = (~w >> 14) & 0x03;
axes[0] = (w == 0xffff) ? -1 : ((w & 0x1fff) << 5);
w = inw(gameport->io + 4);
axes[1] = (w == 0xffff) ? -1 : ((w & 0x1fff) << 5);
w = inw(gameport->io + 6);
*buttons |= ((~w >> 14) & 0x03) << 2;
axes[2] = (w == 0xffff) ? -1 : ((w & 0x1fff) << 5);
w = inw(gameport->io + 8);
axes[3] = (w == 0xffff) ? -1 : ((w & 0x1fff) << 5);
outw(0xff, gameport->io); /* reset */
return 0;
}
#endif
static int fm801_gp_open(struct gameport *gameport, int mode)
{
switch (mode) {
#ifdef HAVE_COOKED
case GAMEPORT_MODE_COOKED:
return 0;
#endif
case GAMEPORT_MODE_RAW:
return 0;
default:
return -1;
}
return 0;
}
static int __devinit fm801_gp_probe(struct pci_dev *pci, const struct pci_device_id *id)
{
struct fm801_gp *gp;
if (! (gp = kmalloc(sizeof(*gp), GFP_KERNEL))) {
printk("cannot malloc for fm801-gp\n");
return -1;
}
memset(gp, 0, sizeof(*gp));
gp->gameport.open = fm801_gp_open;
#ifdef HAVE_COOKED
gp->gameport.cooked_read = fm801_gp_cooked_read;
#endif
pci_enable_device(pci);
gp->gameport.io = pci_resource_start(pci, 0);
if ((gp->res_port = request_region(gp->gameport.io, 0x10, "FM801 GP")) == NULL) {
kfree(gp);
printk("unable to grab region 0x%x-0x%x\n", gp->gameport.io, gp->gameport.io + 0x0f);
return -1;
}
gp->gameport.phys = gp->phys;
gp->gameport.name = gp->name;
gp->gameport.idbus = BUS_PCI;
gp->gameport.idvendor = pci->vendor;
gp->gameport.idproduct = pci->device;
pci_set_drvdata(pci, gp);
outb(0x60, gp->gameport.io + 0x0d); /* enable joystick 1 and 2 */
gameport_register_port(&gp->gameport);
printk(KERN_INFO "gameport: %s at pci%s speed %d kHz\n",
pci->name, pci->slot_name, gp->gameport.speed);
return 0;
}
static void __devexit fm801_gp_remove(struct pci_dev *pci)
{
struct fm801_gp *gp = pci_get_drvdata(pci);
if (gp) {
gameport_unregister_port(&gp->gameport);
release_resource(gp->res_port);
kfree(gp);
}
}
static struct pci_device_id fm801_gp_id_table[] __devinitdata = {
{ PCI_VENDOR_ID_FORTEMEDIA, PCI_DEVICE_ID_FM801_GP, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
{ 0 }
};
static struct pci_driver fm801_gp_driver = {
name: "FM801 GP",
id_table: fm801_gp_id_table,
probe: fm801_gp_probe,
remove: fm801_gp_remove,
};
int __init fm801_gp_init(void)
{
return pci_module_init(&fm801_gp_driver);
}
void __exit fm801_gp_exit(void)
{
pci_unregister_driver(&fm801_gp_driver);
}
module_init(fm801_gp_init);
module_exit(fm801_gp_exit);
MODULE_DEVICE_TABLE(pci, fm801_gp_id_table);
MODULE_AUTHOR("Takashi Iwai <tiwai@suse.de>");
MODULE_LICENSE("GPL");
...@@ -54,16 +54,36 @@ EXPORT_SYMBOL(gameport_cooked_read); ...@@ -54,16 +54,36 @@ EXPORT_SYMBOL(gameport_cooked_read);
static struct gameport *gameport_list; static struct gameport *gameport_list;
static struct gameport_dev *gameport_dev; static struct gameport_dev *gameport_dev;
#ifdef __i386__
#define DELTA(x,y) ((y)-(x)+((y)<(x)?1193180/HZ:0))
#define GET_TIME(x) do { x = get_time_pit(); } while (0)
static unsigned int get_time_pit(void)
{
extern spinlock_t i8253_lock;
unsigned long flags;
unsigned int count;
spin_lock_irqsave(&i8253_lock, flags);
outb_p(0x00, 0x43);
count = inb_p(0x40);
count |= inb_p(0x40) << 8;
spin_unlock_irqrestore(&i8253_lock, flags);
return count;
}
#endif
/* /*
* gameport_measure_speed() measures the gameport i/o speed. * gameport_measure_speed() measures the gameport i/o speed.
*/ */
static int gameport_measure_speed(struct gameport *gameport) static int gameport_measure_speed(struct gameport *gameport)
{ {
#if defined(__i386__) || defined(__x86_64__) #ifdef __i386__
#define GET_TIME(x) do { outb(0, 0x43); x = inb(0x40); x |= inb(0x40) << 8; } while (0)
#define DELTA(x,y) ((y)-(x)+((y)<(x)?1193180L/HZ:0))
unsigned int i, t, t1, t2, t3, tx; unsigned int i, t, t1, t2, t3, tx;
unsigned long flags; unsigned long flags;
......
/* /*
* $Id: pcigame.c,v 1.10 2001/04/26 10:24:46 vojtech Exp $ * $Id: vortex.c,v 1.5 2002/07/01 15:39:30 vojtech Exp $
* *
* Copyright (c) 2000-2001 Vojtech Pavlik * Copyright (c) 2000-2001 Vojtech Pavlik
* *
* Based on the work of: * Based on the work of:
* Raymond Ingles * Raymond Ingles
*
* Sponsored by SuSE
*/ */
/* /*
...@@ -29,8 +27,8 @@ ...@@ -29,8 +27,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* *
* Should you need to contact me, the author, you can do so either by * Should you need to contact me, the author, you can do so either by
* e-mail - mail your message to <vojtech@suse.cz>, or by paper mail: * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
* Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
*/ */
#include <asm/io.h> #include <asm/io.h>
...@@ -44,74 +42,61 @@ ...@@ -44,74 +42,61 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/gameport.h> #include <linux/gameport.h>
#define PCI_VENDOR_ID_AUREAL 0x12eb MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
MODULE_DESCRIPTION("Aureal Vortex and Vortex2 gameport driver");
#define PCIGAME_DATA_WAIT 20 /* 20 ms */ MODULE_LICENSE("GPL");
#define PCIGAME_4DWAVE 0
#define PCIGAME_VORTEX 1
#define PCIGAME_VORTEX2 2
struct pcigame_data {
int gcr; /* Gameport control register */
int legacy; /* Legacy port location */
int axes; /* Axes start */
int axsize; /* Axis field size */
int axmax; /* Axis field max value */
int adcmode; /* Value to enable ADC mode in GCR */
};
static struct pcigame_data pcigame_data[] __devinitdata = #define VORTEX_GCR 0x0c /* Gameport control register */
{{ 0x00030, 0x00031, 0x00034, 2, 0xffff, 0x80 }, #define VORTEX_LEG 0x08 /* Legacy port location */
{ 0x1100c, 0x11008, 0x11010, 4, 0x1fff, 0x40 }, #define VORTEX_AXD 0x10 /* Axes start */
{ 0x2880c, 0x28808, 0x28810, 4, 0x1fff, 0x40 }, #define VORTEX_DATA_WAIT 20 /* 20 ms */
{ 0 }};
struct pcigame { struct vortex {
struct gameport gameport; struct gameport gameport;
struct pci_dev *dev; struct pci_dev *dev;
unsigned char *base; unsigned char *base;
struct pcigame_data *data; unsigned char *io;
char phys[32];
}; };
static unsigned char pcigame_read(struct gameport *gameport) static unsigned char vortex_read(struct gameport *gameport)
{ {
struct pcigame *pcigame = gameport->private; struct vortex *vortex = gameport->driver;
return readb(pcigame->base + pcigame->data->legacy); return readb(vortex->io + VORTEX_LEG);
} }
static void pcigame_trigger(struct gameport *gameport) static void vortex_trigger(struct gameport *gameport)
{ {
struct pcigame *pcigame = gameport->private; struct vortex *vortex = gameport->driver;
writeb(0xff, pcigame->base + pcigame->data->legacy); writeb(0xff, vortex->io + VORTEX_LEG);
} }
static int pcigame_cooked_read(struct gameport *gameport, int *axes, int *buttons) static int vortex_cooked_read(struct gameport *gameport, int *axes, int *buttons)
{ {
struct pcigame *pcigame = gameport->private; struct vortex *vortex = gameport->driver;
int i; int i;
*buttons = (~readb(pcigame->base + pcigame->data->legacy) >> 4) & 0xf; *buttons = (~readb(vortex->base + VORTEX_LEG) >> 4) & 0xf;
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
axes[i] = readw(pcigame->base + pcigame->data->axes + i * pcigame->data->axsize); axes[i] = readw(vortex->io + VORTEX_AXD + i * sizeof(u32));
if (axes[i] == pcigame->data->axmax) axes[i] = -1; if (axes[i] == 0x1fff) axes[i] = -1;
} }
return 0; return 0;
} }
static int pcigame_open(struct gameport *gameport, int mode) static int vortex_open(struct gameport *gameport, int mode)
{ {
struct pcigame *pcigame = gameport->private; struct vortex *vortex = gameport->driver;
switch (mode) { switch (mode) {
case GAMEPORT_MODE_COOKED: case GAMEPORT_MODE_COOKED:
writeb(pcigame->data->adcmode, pcigame->base + pcigame->data->gcr); writeb(0x40, vortex->io + VORTEX_GCR);
wait_ms(PCIGAME_DATA_WAIT); wait_ms(VORTEX_DATA_WAIT);
return 0; return 0;
case GAMEPORT_MODE_RAW: case GAMEPORT_MODE_RAW:
writeb(0, pcigame->base + pcigame->data->gcr); writeb(0x00, vortex->io + VORTEX_GCR);
return 0; return 0;
default: default:
return -1; return -1;
...@@ -120,28 +105,33 @@ static int pcigame_open(struct gameport *gameport, int mode) ...@@ -120,28 +105,33 @@ static int pcigame_open(struct gameport *gameport, int mode)
return 0; return 0;
} }
static int __devinit pcigame_probe(struct pci_dev *dev, const struct pci_device_id *id) static int __devinit vortex_probe(struct pci_dev *dev, const struct pci_device_id *id)
{ {
struct pcigame *pcigame; struct vortex *vortex;
int i; int i;
if (!(pcigame = kmalloc(sizeof(struct pcigame), GFP_KERNEL))) if (!(vortex = kmalloc(sizeof(struct vortex), GFP_KERNEL)))
return -1; return -1;
memset(pcigame, 0, sizeof(struct pcigame)); memset(vortex, 0, sizeof(struct vortex));
vortex->dev = dev;
sprintf(vortex->phys, "pci%s/gameport0", dev->slot_name);
pcigame->data = pcigame_data + id->driver_data; pci_set_drvdata(dev, vortex);
pcigame->dev = dev; vortex->gameport.driver = vortex;
pci_set_drvdata(dev, pcigame); vortex->gameport.fuzz = 64;
pcigame->gameport.private = pcigame; vortex->gameport.read = vortex_read;
pcigame->gameport.fuzz = 64; vortex->gameport.trigger = vortex_trigger;
vortex->gameport.cooked_read = vortex_cooked_read;
vortex->gameport.open = vortex_open;
pcigame->gameport.read = pcigame_read; vortex->gameport.name = dev->name;
pcigame->gameport.trigger = pcigame_trigger; vortex->gameport.phys = vortex->phys;
pcigame->gameport.cooked_read = pcigame_cooked_read; vortex->gameport.idbus = BUS_PCI;
pcigame->gameport.open = pcigame_open; vortex->gameport.idvendor = dev->vendor;
vortex->gameport.idproduct = dev->device;
for (i = 0; i < 6; i++) for (i = 0; i < 6; i++)
if (~pci_resource_flags(dev, i) & IORESOURCE_IO) if (~pci_resource_flags(dev, i) & IORESOURCE_IO)
...@@ -149,51 +139,47 @@ static int __devinit pcigame_probe(struct pci_dev *dev, const struct pci_device_ ...@@ -149,51 +139,47 @@ static int __devinit pcigame_probe(struct pci_dev *dev, const struct pci_device_
pci_enable_device(dev); pci_enable_device(dev);
pcigame->base = ioremap(pci_resource_start(pcigame->dev, i), vortex->base = ioremap(pci_resource_start(vortex->dev, i),
pci_resource_len(pcigame->dev, i)); pci_resource_len(vortex->dev, i));
vortex->io = vortex->base + id->driver_data;
gameport_register_port(&pcigame->gameport); gameport_register_port(&vortex->gameport);
printk(KERN_INFO "gameport%d: %s at pci%02x:%02x.%x speed %d kHz\n", printk(KERN_INFO "gameport: %s at pci%s speed %d kHz\n",
pcigame->gameport.number, dev->name, dev->bus->number, dev->name, dev->slot_name, vortex->gameport.speed);
PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn), pcigame->gameport.speed);
return 0; return 0;
} }
static void __devexit pcigame_remove(struct pci_dev *dev) static void __devexit vortex_remove(struct pci_dev *dev)
{ {
struct pcigame *pcigame = pci_get_drvdata(dev); struct vortex *vortex = pci_get_drvdata(dev);
gameport_unregister_port(&pcigame->gameport); gameport_unregister_port(&vortex->gameport);
iounmap(pcigame->base); iounmap(vortex->base);
kfree(pcigame); kfree(vortex);
} }
static struct pci_device_id pcigame_id_table[] __devinitdata = static struct pci_device_id vortex_id_table[] __devinitdata =
{{ PCI_VENDOR_ID_TRIDENT, 0x2000, PCI_ANY_ID, PCI_ANY_ID, 0, 0, PCIGAME_4DWAVE }, {{ 0x12eb, 0x0001, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0x11000 },
{ PCI_VENDOR_ID_TRIDENT, 0x2001, PCI_ANY_ID, PCI_ANY_ID, 0, 0, PCIGAME_4DWAVE }, { 0x12eb, 0x0002, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0x28800 },
{ PCI_VENDOR_ID_AUREAL, 0x0001, PCI_ANY_ID, PCI_ANY_ID, 0, 0, PCIGAME_VORTEX },
{ PCI_VENDOR_ID_AUREAL, 0x0002, PCI_ANY_ID, PCI_ANY_ID, 0, 0, PCIGAME_VORTEX2 },
{ 0 }}; { 0 }};
static struct pci_driver pcigame_driver = { static struct pci_driver vortex_driver = {
name: "pcigame", name: "vortex",
id_table: pcigame_id_table, id_table: vortex_id_table,
probe: pcigame_probe, probe: vortex_probe,
remove: __devexit_p(pcigame_remove), remove: vortex_remove,
}; };
int __init pcigame_init(void) int __init vortex_init(void)
{ {
return pci_module_init(&pcigame_driver); return pci_module_init(&vortex_driver);
} }
void __exit pcigame_exit(void) void __exit vortex_exit(void)
{ {
pci_unregister_driver(&pcigame_driver); pci_unregister_driver(&vortex_driver);
} }
module_init(pcigame_init); module_init(vortex_init);
module_exit(pcigame_exit); module_exit(vortex_exit);
MODULE_LICENSE("GPL");
...@@ -61,8 +61,6 @@ static struct input_dev *input_dev; ...@@ -61,8 +61,6 @@ static struct input_dev *input_dev;
static struct input_handler *input_handler; static struct input_handler *input_handler;
static struct input_handler *input_table[8]; static struct input_handler *input_table[8];
static devfs_handle_t input_devfs_handle; static devfs_handle_t input_devfs_handle;
static int input_number;
static long input_devices[NBITS(INPUT_DEVICES)];
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
static struct proc_dir_entry *proc_bus_input_dir; static struct proc_dir_entry *proc_bus_input_dir;
...@@ -454,17 +452,8 @@ void input_register_device(struct input_dev *dev) ...@@ -454,17 +452,8 @@ void input_register_device(struct input_dev *dev)
* Add the device. * Add the device.
*/ */
if (input_number >= INPUT_DEVICES) {
printk(KERN_WARNING "input: ran out of input device numbers!\n");
dev->number = input_number;
} else {
dev->number = find_first_zero_bit(input_devices, INPUT_DEVICES);
set_bit(dev->number, input_devices);
}
dev->next = input_dev; dev->next = input_dev;
input_dev = dev; input_dev = dev;
input_number++;
/* /*
* Notify handlers. * Notify handlers.
...@@ -493,7 +482,6 @@ void input_register_device(struct input_dev *dev) ...@@ -493,7 +482,6 @@ void input_register_device(struct input_dev *dev)
input_devices_state++; input_devices_state++;
wake_up(&input_devices_poll_wait); wake_up(&input_devices_poll_wait);
#endif #endif
} }
void input_unregister_device(struct input_dev *dev) void input_unregister_device(struct input_dev *dev)
...@@ -509,7 +497,6 @@ void input_unregister_device(struct input_dev *dev) ...@@ -509,7 +497,6 @@ void input_unregister_device(struct input_dev *dev)
if (dev->pm_dev) if (dev->pm_dev)
pm_unregister(dev->pm_dev); pm_unregister(dev->pm_dev);
/* /*
* Kill any pending repeat timers. * Kill any pending repeat timers.
*/ */
...@@ -540,7 +527,6 @@ void input_unregister_device(struct input_dev *dev) ...@@ -540,7 +527,6 @@ void input_unregister_device(struct input_dev *dev)
*/ */
input_find_and_remove(struct input_dev, input_dev, dev, next); input_find_and_remove(struct input_dev, input_dev, dev, next);
input_number--;
/* /*
* Notify /proc. * Notify /proc.
*/ */
......
/* /*
* $Id: joydev.c,v 1.38 2001/12/27 10:37:41 vojtech Exp $ * $Id: joydev.c,v 1.43 2002/04/09 23:59:01 jsimmons Exp $
* *
* Copyright (c) 1999-2001 Vojtech Pavlik * Copyright (c) 1999-2001 Vojtech Pavlik
* Copyright (c) 1999 Colin Van Dyke * Copyright (c) 1999 Colin Van Dyke
...@@ -49,7 +49,7 @@ MODULE_SUPPORTED_DEVICE("input/js"); ...@@ -49,7 +49,7 @@ MODULE_SUPPORTED_DEVICE("input/js");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
#define JOYDEV_MINOR_BASE 0 #define JOYDEV_MINOR_BASE 0
#define JOYDEV_MINORS 32 #define JOYDEV_MINORS 16
#define JOYDEV_BUFFER_SIZE 64 #define JOYDEV_BUFFER_SIZE 64
#define MSECS(t) (1000 * ((t) / HZ) + 1000 * ((t) % HZ) / HZ) #define MSECS(t) (1000 * ((t) / HZ) + 1000 * ((t) % HZ) / HZ)
...@@ -254,6 +254,10 @@ static ssize_t joydev_read(struct file *file, char *buf, size_t count, loff_t *p ...@@ -254,6 +254,10 @@ static ssize_t joydev_read(struct file *file, char *buf, size_t count, loff_t *p
while (list->head == list->tail) { while (list->head == list->tail) {
if (!joydev->exist) {
retval = -ENODEV;
break;
}
if (file->f_flags & O_NONBLOCK) { if (file->f_flags & O_NONBLOCK) {
retval = -EAGAIN; retval = -EAGAIN;
break; break;
...@@ -325,6 +329,8 @@ static int joydev_ioctl(struct inode *inode, struct file *file, unsigned int cmd ...@@ -325,6 +329,8 @@ static int joydev_ioctl(struct inode *inode, struct file *file, unsigned int cmd
struct input_dev *dev = joydev->handle.dev; struct input_dev *dev = joydev->handle.dev;
int i; int i;
if (!joydev->exist) return -ENODEV;
switch (cmd) { switch (cmd) {
case JS_SET_CAL: case JS_SET_CAL:
......
CONFIG_JOYSTICK CONFIG_INPUT_JOYSTICK
If you have a joystick, 6dof controller, gamepad, steering wheel, If you have a joystick, 6dof controller, gamepad, steering wheel,
weapon control system or something like that you can say Y here weapon control system or something like that you can say Y here
and the list of supported devices will be displayed. This option and the list of supported devices will be displayed. This option
...@@ -67,6 +67,15 @@ CONFIG_JOYSTICK_GRIP ...@@ -67,6 +67,15 @@ CONFIG_JOYSTICK_GRIP
The module will be called grip.o. If you want to compile it as a The module will be called grip.o. If you want to compile it as a
module, say M here and read <file:Documentation/modules.txt>. module, say M here and read <file:Documentation/modules.txt>.
CONFIG_JOYSTICK_GUILLEMOT
Say Y here if you have a Guillemot joystick using a digital
protocol over the PC gameport.
This driver is also available as a module ( = code which can be
inserted in and removed from the running kernel whenever you want).
The module will be called guillemot.o. If you want to compile it as a
module, say M here and read <file:Documentation/modules.txt>.
CONFIG_JOYSTICK_INTERACT CONFIG_JOYSTICK_INTERACT
Say Y here if you have an InterAct gameport or joystick Say Y here if you have an InterAct gameport or joystick
communicating digitally over the gameport. communicating digitally over the gameport.
...@@ -158,6 +167,15 @@ CONFIG_JOYSTICK_STINGER ...@@ -158,6 +167,15 @@ CONFIG_JOYSTICK_STINGER
The module will be called stinger.o. If you want to compile it as a The module will be called stinger.o. If you want to compile it as a
module, say M here and read <file:Documentation/modules.txt>. module, say M here and read <file:Documentation/modules.txt>.
CONFIG_JOYSTICK_TWIDDLER
Say Y here if you have a Handykey Twiddler connected to your
computer's serial port and want to use it as a joystick.
This driver is also available as a module ( = code which can be
inserted in and removed from the running kernel whenever you want).
The module will be called twidjoy.o. If you want to compile it as a
module, say M here and read <file:Documentation/modules.txt>.
CONFIG_JOYSTICK_DB9 CONFIG_JOYSTICK_DB9
Say Y here if you have a Sega Master System gamepad, Sega Genesis Say Y here if you have a Sega Master System gamepad, Sega Genesis
gamepad, Sega Saturn gamepad, or a Multisystem -- Atari, Amiga, gamepad, Sega Saturn gamepad, or a Multisystem -- Atari, Amiga,
...@@ -203,3 +221,12 @@ CONFIG_JOYSTICK_AMIJOY ...@@ -203,3 +221,12 @@ CONFIG_JOYSTICK_AMIJOY
The module will be called joy-amiga.o. If you want to compile it as The module will be called joy-amiga.o. If you want to compile it as
a module, say M here and read <file:Documentation/modules.txt>. a module, say M here and read <file:Documentation/modules.txt>.
CONFIG_INPUT_JOYDUMP
Say Y here if you want to dump data from your joystick into the system
log for debugging purposes. Say N if you are making a production
configuration or aren't sure.
This driver is also available as a module ( = code which can be
inserted in and removed from the running kernel whenever you want).
The module will be called joydump.o. If you want to compile it as
a module, say M here and read <file:Documentation/modules.txt>.
...@@ -10,6 +10,7 @@ dep_tristate ' Logitech ADI digital joysticks and gamepads' CONFIG_JOYSTICK_ADI ...@@ -10,6 +10,7 @@ dep_tristate ' Logitech ADI digital joysticks and gamepads' CONFIG_JOYSTICK_ADI
dep_tristate ' Creative Labs Blaster Cobra gamepad' CONFIG_JOYSTICK_COBRA $CONFIG_INPUT $CONFIG_INPUT_JOYSTICK $CONFIG_GAMEPORT dep_tristate ' Creative Labs Blaster Cobra gamepad' CONFIG_JOYSTICK_COBRA $CONFIG_INPUT $CONFIG_INPUT_JOYSTICK $CONFIG_GAMEPORT
dep_tristate ' Genius Flight2000 Digital joysticks and gamepads' CONFIG_JOYSTICK_GF2K $CONFIG_INPUT $CONFIG_INPUT_JOYSTICK $CONFIG_GAMEPORT dep_tristate ' Genius Flight2000 Digital joysticks and gamepads' CONFIG_JOYSTICK_GF2K $CONFIG_INPUT $CONFIG_INPUT_JOYSTICK $CONFIG_GAMEPORT
dep_tristate ' Gravis GrIP joysticks and gamepads' CONFIG_JOYSTICK_GRIP $CONFIG_INPUT $CONFIG_INPUT_JOYSTICK $CONFIG_GAMEPORT dep_tristate ' Gravis GrIP joysticks and gamepads' CONFIG_JOYSTICK_GRIP $CONFIG_INPUT $CONFIG_INPUT_JOYSTICK $CONFIG_GAMEPORT
dep_tristate ' Guillemot joysticks and gamepads' CONFIG_JOYSTICK_GUILLEMOT $CONFIG_INPUT $CONFIG_INPUT_JOYSTICK $CONFIG_GAMEPORT
dep_tristate ' InterAct digital joysticks and gamepads' CONFIG_JOYSTICK_INTERACT $CONFIG_INPUT $CONFIG_INPUT_JOYSTICK $CONFIG_GAMEPORT dep_tristate ' InterAct digital joysticks and gamepads' CONFIG_JOYSTICK_INTERACT $CONFIG_INPUT $CONFIG_INPUT_JOYSTICK $CONFIG_GAMEPORT
dep_tristate ' Microsoft SideWinder digital joysticks and gamepads' CONFIG_JOYSTICK_SIDEWINDER $CONFIG_INPUT $CONFIG_INPUT_JOYSTICK $CONFIG_GAMEPORT dep_tristate ' Microsoft SideWinder digital joysticks and gamepads' CONFIG_JOYSTICK_SIDEWINDER $CONFIG_INPUT $CONFIG_INPUT_JOYSTICK $CONFIG_GAMEPORT
dep_tristate ' ThrustMaster DirectConnect joysticks and gamepads' CONFIG_JOYSTICK_TMDC $CONFIG_INPUT $CONFIG_INPUT_JOYSTICK $CONFIG_GAMEPORT dep_tristate ' ThrustMaster DirectConnect joysticks and gamepads' CONFIG_JOYSTICK_TMDC $CONFIG_INPUT $CONFIG_INPUT_JOYSTICK $CONFIG_GAMEPORT
...@@ -21,6 +22,7 @@ dep_tristate ' LogiCad3d Magellan/SpaceMouse 6dof controllers' CONFIG_JOYSTICK_ ...@@ -21,6 +22,7 @@ dep_tristate ' LogiCad3d Magellan/SpaceMouse 6dof controllers' CONFIG_JOYSTICK_
dep_tristate ' SpaceTec SpaceOrb/Avenger 6dof controllers' CONFIG_JOYSTICK_SPACEORB $CONFIG_INPUT $CONFIG_INPUT_JOYSTICK $CONFIG_SERIO dep_tristate ' SpaceTec SpaceOrb/Avenger 6dof controllers' CONFIG_JOYSTICK_SPACEORB $CONFIG_INPUT $CONFIG_INPUT_JOYSTICK $CONFIG_SERIO
dep_tristate ' SpaceTec SpaceBall 6dof controllers' CONFIG_JOYSTICK_SPACEBALL $CONFIG_INPUT $CONFIG_INPUT_JOYSTICK $CONFIG_SERIO dep_tristate ' SpaceTec SpaceBall 6dof controllers' CONFIG_JOYSTICK_SPACEBALL $CONFIG_INPUT $CONFIG_INPUT_JOYSTICK $CONFIG_SERIO
dep_tristate ' Gravis Stinger gamepad' CONFIG_JOYSTICK_STINGER $CONFIG_INPUT $CONFIG_INPUT_JOYSTICK $CONFIG_SERIO dep_tristate ' Gravis Stinger gamepad' CONFIG_JOYSTICK_STINGER $CONFIG_INPUT $CONFIG_INPUT_JOYSTICK $CONFIG_SERIO
dep_tristate ' Twiddler as a joystick' CONFIG_JOYSTICK_TWIDDLER $CONFIG_INPUT $CONFIG_INPUT_JOYSTICK $CONFIG_SERIO
dep_tristate ' Multisystem, Sega Genesis, Saturn joysticks and gamepads' CONFIG_JOYSTICK_DB9 $CONFIG_INPUT $CONFIG_INPUT_JOYSTICK $CONFIG_PARPORT dep_tristate ' Multisystem, Sega Genesis, Saturn joysticks and gamepads' CONFIG_JOYSTICK_DB9 $CONFIG_INPUT $CONFIG_INPUT_JOYSTICK $CONFIG_PARPORT
dep_tristate ' Multisystem, NES, SNES, N64, PSX joysticks and gamepads' CONFIG_JOYSTICK_GAMECON $CONFIG_INPUT $CONFIG_INPUT_JOYSTICK $CONFIG_PARPORT dep_tristate ' Multisystem, NES, SNES, N64, PSX joysticks and gamepads' CONFIG_JOYSTICK_GAMECON $CONFIG_INPUT $CONFIG_INPUT_JOYSTICK $CONFIG_PARPORT
...@@ -29,3 +31,5 @@ dep_tristate ' Multisystem joysticks via TurboGraFX device' CONFIG_JOYSTICK_TUR ...@@ -29,3 +31,5 @@ dep_tristate ' Multisystem joysticks via TurboGraFX device' CONFIG_JOYSTICK_TUR
if [ "$CONFIG_AMIGA" = "y" ]; then if [ "$CONFIG_AMIGA" = "y" ]; then
dep_tristate ' Amiga joysticks' CONFIG_JOYSTICK_AMIJOY $CONFIG_INPUT $CONFIG_INPUT_JOYSTICK dep_tristate ' Amiga joysticks' CONFIG_JOYSTICK_AMIJOY $CONFIG_INPUT $CONFIG_INPUT_JOYSTICK
fi fi
dep_tristate ' Gameport data dumper' CONFIG_INPUT_JOYDUMP $CONFIG_INPUT $CONFIG_INPUT_JOYSTICK
...@@ -31,8 +31,9 @@ obj-$(CONFIG_JOYSTICK_DB9) += db9.o ...@@ -31,8 +31,9 @@ obj-$(CONFIG_JOYSTICK_DB9) += db9.o
obj-$(CONFIG_JOYSTICK_GAMECON) += gamecon.o obj-$(CONFIG_JOYSTICK_GAMECON) += gamecon.o
obj-$(CONFIG_JOYSTICK_GF2K) += gf2k.o obj-$(CONFIG_JOYSTICK_GF2K) += gf2k.o
obj-$(CONFIG_JOYSTICK_GRIP) += grip.o obj-$(CONFIG_JOYSTICK_GRIP) += grip.o
obj-$(CONFIG_JOYSTICK_IFORCE) += iforce.o obj-$(CONFIG_JOYSTICK_GUILLEMOT) += guillemot.o
obj-$(CONFIG_JOYSTICK_INTERACT) += interact.o obj-$(CONFIG_JOYSTICK_INTERACT) += interact.o
obj-$(CONFIG_JOYSTICK_JOYDUMP) += joydump.o
obj-$(CONFIG_JOYSTICK_MAGELLAN) += magellan.o obj-$(CONFIG_JOYSTICK_MAGELLAN) += magellan.o
obj-$(CONFIG_JOYSTICK_SIDEWINDER) += sidewinder.o obj-$(CONFIG_JOYSTICK_SIDEWINDER) += sidewinder.o
obj-$(CONFIG_JOYSTICK_SPACEBALL) += spaceball.o obj-$(CONFIG_JOYSTICK_SPACEBALL) += spaceball.o
...@@ -40,8 +41,11 @@ obj-$(CONFIG_JOYSTICK_SPACEORB) += spaceorb.o ...@@ -40,8 +41,11 @@ obj-$(CONFIG_JOYSTICK_SPACEORB) += spaceorb.o
obj-$(CONFIG_JOYSTICK_STINGER) += stinger.o obj-$(CONFIG_JOYSTICK_STINGER) += stinger.o
obj-$(CONFIG_JOYSTICK_TMDC) += tmdc.o obj-$(CONFIG_JOYSTICK_TMDC) += tmdc.o
obj-$(CONFIG_JOYSTICK_TURBOGRAFX) += turbografx.o obj-$(CONFIG_JOYSTICK_TURBOGRAFX) += turbografx.o
obj-$(CONFIG_JOYSTICK_TWIDJOY) += twidjoy.o
obj-$(CONFIG_JOYSTICK_WARRIOR) += warrior.o obj-$(CONFIG_JOYSTICK_WARRIOR) += warrior.o
obj-$(CONFIG_JOYSTICK_IFORCE) += iforce/
# The global Rules.make. # The global Rules.make.
include $(TOPDIR)/Rules.make include $(TOPDIR)/Rules.make
...@@ -426,10 +426,10 @@ static void adi_init_input(struct adi *adi, struct adi_port *port, int half) ...@@ -426,10 +426,10 @@ static void adi_init_input(struct adi *adi, struct adi_port *port, int half)
adi->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); adi->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
for (i = 0; i < adi->axes10 + adi->axes8 + (adi->hats + (adi->pad != -1)) * 2; i++) for (i = 0; i < adi->axes10 + adi->axes8 + (adi->hats + (adi->pad != -1)) * 2; i++)
set_bit(adi->abs[i], &adi->dev.absbit); set_bit(adi->abs[i], adi->dev.absbit);
for (i = 0; i < adi->buttons; i++) for (i = 0; i < adi->buttons; i++)
set_bit(adi->key[i], &adi->dev.keybit); set_bit(adi->key[i], adi->dev.keybit);
} }
static void adi_init_center(struct adi *adi) static void adi_init_center(struct adi *adi)
......
/* /*
* $Id: db9.c,v 1.12 2002/01/22 20:27:05 vojtech Exp $ * $Id: db9.c,v 1.13 2002/04/07 20:13:37 vojtech Exp $
* *
* Copyright (c) 1999-2001 Vojtech Pavlik * Copyright (c) 1999-2001 Vojtech Pavlik
* *
...@@ -199,7 +199,7 @@ static void db9_timer(unsigned long private) ...@@ -199,7 +199,7 @@ static void db9_timer(unsigned long private)
data=parport_read_data(port); data=parport_read_data(port);
input_report_key(dev, BTN_A, ~data & DB9_FIRE1); input_report_key(dev, BTN_A, ~data & DB9_FIRE1);
input_report_key(dev, BTN_X, ~data & DB9_FIRE2); input_report_key(dev, BTN_START, ~data & DB9_FIRE2);
parport_write_control(port, DB9_NOSELECT); /* 2 */ parport_write_control(port, DB9_NOSELECT); /* 2 */
udelay(DB9_GENESIS6_DELAY); udelay(DB9_GENESIS6_DELAY);
...@@ -209,10 +209,10 @@ static void db9_timer(unsigned long private) ...@@ -209,10 +209,10 @@ static void db9_timer(unsigned long private)
udelay(DB9_GENESIS6_DELAY); udelay(DB9_GENESIS6_DELAY);
data=parport_read_data(port); data=parport_read_data(port);
input_report_key(dev, BTN_Y, ~data & DB9_LEFT); input_report_key(dev, BTN_X, ~data & DB9_LEFT);
input_report_key(dev, BTN_Z, ~data & DB9_DOWN); input_report_key(dev, BTN_Y, ~data & DB9_DOWN);
input_report_key(dev, BTN_MODE, ~data & DB9_UP); input_report_key(dev, BTN_Z, ~data & DB9_UP);
input_report_key(dev, BTN_START, ~data & DB9_RIGHT); input_report_key(dev, BTN_MODE, ~data & DB9_RIGHT);
parport_write_control(port, DB9_NORMAL); parport_write_control(port, DB9_NORMAL);
udelay(DB9_GENESIS6_DELAY); udelay(DB9_GENESIS6_DELAY);
......
/* /*
* $Id: gamecon.c,v 1.21 2002/01/22 20:27:27 vojtech Exp $ * $Id: gamecon.c,v 1.22 2002/07/01 15:42:25 vojtech Exp $
* *
* Copyright (c) 1999-2001 Vojtech Pavlik * Copyright (c) 1999-2001 Vojtech Pavlik
* *
...@@ -398,8 +398,8 @@ static void gc_timer(unsigned long private) ...@@ -398,8 +398,8 @@ static void gc_timer(unsigned long private)
case GC_PSX_RUMBLE: case GC_PSX_RUMBLE:
input_report_key(dev + i, BTN_THUMB, ~data[0] & 0x04); input_report_key(dev + i, BTN_THUMBL, ~data[0] & 0x04);
input_report_key(dev + i, BTN_THUMB2, ~data[0] & 0x02); input_report_key(dev + i, BTN_THUMBR, ~data[0] & 0x02);
case GC_PSX_NEGCON: case GC_PSX_NEGCON:
case GC_PSX_ANALOG: case GC_PSX_ANALOG:
......
/*
* $Id: guillemot.c,v 1.10 2002/01/22 20:28:12 vojtech Exp $
*
* Copyright (c) 2001 Vojtech Pavlik
*/
/*
* Guillemot Digital Interface Protocol driver for Linux
*/
/*
* 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. 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Should you need to contact me, the author, you can do so either by
* e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
* Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
*/
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/delay.h>
#include <linux/init.h>
#include <linux/gameport.h>
#include <linux/input.h>
MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
MODULE_DESCRIPTION("Guillemot Digital joystick driver");
MODULE_LICENSE("GPL");
#define GUILLEMOT_MAX_START 600 /* 600 us */
#define GUILLEMOT_MAX_STROBE 60 /* 60 us */
#define GUILLEMOT_MAX_LENGTH 17 /* 17 bytes */
#define GUILLEMOT_REFRESH_TIME HZ/50 /* 20 ms */
static short guillemot_abs_pad[] =
{ ABS_X, ABS_Y, ABS_THROTTLE, ABS_RUDDER, -1 };
static short guillemot_btn_pad[] =
{ BTN_A, BTN_B, BTN_C, BTN_X, BTN_Y, BTN_Z, BTN_TL, BTN_TR, BTN_MODE, BTN_SELECT, -1 };
static struct {
int x;
int y;
} guillemot_hat_to_axis[16] = {{ 0,-1}, { 1,-1}, { 1, 0}, { 1, 1}, { 0, 1}, {-1, 1}, {-1, 0}, {-1,-1}};
struct guillemot_type {
unsigned char id;
short *abs;
short *btn;
int hat;
char *name;
};
struct guillemot {
struct gameport *gameport;
struct input_dev dev;
struct timer_list timer;
int used;
int bads;
int reads;
struct guillemot_type *type;
unsigned char length;
char phys[32];
};
static struct guillemot_type guillemot_type[] = {
{ 0x00, guillemot_abs_pad, guillemot_btn_pad, 1, "Guillemot Pad" },
{ 0 }};
/*
* guillemot_read_packet() reads Guillemot joystick data.
*/
static int guillemot_read_packet(struct gameport *gameport, u8 *data)
{
unsigned long flags;
unsigned char u, v;
unsigned int t, s;
int i;
for (i = 0; i < GUILLEMOT_MAX_LENGTH; i++)
data[i] = 0;
i = 0;
t = gameport_time(gameport, GUILLEMOT_MAX_START);
s = gameport_time(gameport, GUILLEMOT_MAX_STROBE);
__save_flags(flags);
__cli();
gameport_trigger(gameport);
v = gameport_read(gameport);
while (t > 0 && i < GUILLEMOT_MAX_LENGTH * 8) {
t--;
u = v; v = gameport_read(gameport);
if (v & ~u & 0x10) {
data[i >> 3] |= ((v >> 5) & 1) << (i & 7);
i++;
t = s;
}
}
__restore_flags(flags);
return i;
}
/*
* guillemot_timer() reads and analyzes Guillemot joystick data.
*/
static void guillemot_timer(unsigned long private)
{
struct guillemot *guillemot = (struct guillemot *) private;
struct input_dev *dev = &guillemot->dev;
u8 data[GUILLEMOT_MAX_LENGTH];
int i;
guillemot->reads++;
if (guillemot_read_packet(guillemot->gameport, data) != GUILLEMOT_MAX_LENGTH * 8 ||
data[0] != 0x55 || data[16] != 0xaa) {
guillemot->bads++;
} else {
for (i = 0; i < 6 && guillemot->type->abs[i] >= 0; i++)
input_report_abs(dev, guillemot->type->abs[i], data[i + 5]);
if (guillemot->type->hat) {
input_report_abs(dev, ABS_HAT0X, guillemot_hat_to_axis[data[4] >> 4].x);
input_report_abs(dev, ABS_HAT0Y, guillemot_hat_to_axis[data[4] >> 4].y);
}
for (i = 0; i < 16 && guillemot->type->btn[i] >= 0; i++)
input_report_key(dev, guillemot->type->btn[i], (data[2 + (i >> 3)] >> (i & 7)) & 1);
}
mod_timer(&guillemot->timer, jiffies + GUILLEMOT_REFRESH_TIME);
}
/*
* guillemot_open() is a callback from the input open routine.
*/
static int guillemot_open(struct input_dev *dev)
{
struct guillemot *guillemot = dev->private;
if (!guillemot->used++)
mod_timer(&guillemot->timer, jiffies + GUILLEMOT_REFRESH_TIME);
return 0;
}
/*
* guillemot_close() is a callback from the input close routine.
*/
static void guillemot_close(struct input_dev *dev)
{
struct guillemot *guillemot = dev->private;
if (!--guillemot->used)
del_timer(&guillemot->timer);
}
/*
* guillemot_connect() probes for Guillemot joysticks.
*/
static void guillemot_connect(struct gameport *gameport, struct gameport_dev *dev)
{
struct guillemot *guillemot;
u8 data[GUILLEMOT_MAX_LENGTH];
int i, t;
if (!(guillemot = kmalloc(sizeof(struct guillemot), GFP_KERNEL)))
return;
memset(guillemot, 0, sizeof(struct guillemot));
gameport->private = guillemot;
guillemot->gameport = gameport;
init_timer(&guillemot->timer);
guillemot->timer.data = (long) guillemot;
guillemot->timer.function = guillemot_timer;
if (gameport_open(gameport, dev, GAMEPORT_MODE_RAW))
goto fail1;
i = guillemot_read_packet(gameport, data);
if (i != GUILLEMOT_MAX_LENGTH * 8 || data[0] != 0x55 || data[16] != 0xaa)
goto fail2;
for (i = 0; guillemot_type[i].name; i++)
if (guillemot_type[i].id == data[11])
break;
if (!guillemot_type[i].name) {
printk(KERN_WARNING "guillemot.c: Unknown joystick on %s. [ %02x%02x:%04x, ver %d.%02d ]\n",
gameport->phys, data[12], data[13], data[11], data[14], data[15]);
goto fail2;
}
sprintf(guillemot->phys, "%s/input0", gameport->phys);
guillemot->type = guillemot_type + i;
guillemot->dev.private = guillemot;
guillemot->dev.open = guillemot_open;
guillemot->dev.close = guillemot_close;
guillemot->dev.name = guillemot_type[i].name;
guillemot->dev.phys = guillemot->phys;
guillemot->dev.idbus = BUS_GAMEPORT;
guillemot->dev.idvendor = GAMEPORT_ID_VENDOR_GUILLEMOT;
guillemot->dev.idproduct = guillemot_type[i].id;
guillemot->dev.idversion = (int)data[14] << 8 | data[15];
guillemot->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
for (i = 0; (t = guillemot->type->abs[i]) >= 0; i++) {
set_bit(t, guillemot->dev.absbit);
guillemot->dev.absmin[t] = 0;
guillemot->dev.absmax[t] = 255;
}
if (guillemot->type->hat)
for (i = 0; i < 2; i++) {
t = ABS_HAT0X + i;
set_bit(t, guillemot->dev.absbit);
guillemot->dev.absmin[t] = -1;
guillemot->dev.absmax[t] = 1;
}
for (i = 0; (t = guillemot->type->btn[i]) >= 0; i++)
set_bit(t, guillemot->dev.keybit);
input_register_device(&guillemot->dev);
printk(KERN_INFO "input: %s ver %d.%02d on %s\n",
guillemot->type->name, data[14], data[15], gameport->phys);
return;
fail2: gameport_close(gameport);
fail1: kfree(guillemot);
}
static void guillemot_disconnect(struct gameport *gameport)
{
struct guillemot *guillemot = gameport->private;
printk(KERN_INFO "guillemot.c: Failed %d reads out of %d on %s\n", guillemot->reads, guillemot->bads, guillemot->phys);
input_unregister_device(&guillemot->dev);
gameport_close(gameport);
kfree(guillemot);
}
static struct gameport_dev guillemot_dev = {
connect: guillemot_connect,
disconnect: guillemot_disconnect,
};
int __init guillemot_init(void)
{
gameport_register_device(&guillemot_dev);
return 0;
}
void __exit guillemot_exit(void)
{
gameport_unregister_device(&guillemot_dev);
}
module_init(guillemot_init);
module_exit(guillemot_exit);
This diff is collapsed.
#
# Makefile for the I-Force driver
#
# I-Force may need both USB and RS-232
CONFIG_JOYSTICK_IFORCE := n
ifeq ($(CONFIG_JOYSTICK_IFORCE_232),y)
ifeq ($(CONFIG_JOYSTICK_IFORCE_USB),y)
CONFIG_JOYSTICK_IFORCE := y
endif
endif
ifeq ($(CONFIG_JOYSTICK_IFORCE_232),m)
CONFIG_JOYSTICK_IFORCE := m
endif
ifeq ($(CONFIG_JOYSTICK_IFORCE_USB),m)
CONFIG_JOYSTICK_IFORCE := m
endif
obj-$(CONFIG_JOYSTICK_IFORCE) += iforce.o
# The global Rules.make.
include $(TOPDIR)/Rules.make
# iforce.o is a multipart module.
IFORCEOBJS = iforce-ff.o iforce-main.o iforce-packets.o
ifneq ($(CONFIG_JOYSTICK_IFORCE_232),)
IFORCEOBJS += iforce-serio.o
endif
ifneq ($(CONFIG_JOYSTICK_IFORCE_USB),)
IFORCEOBJS += iforce-usb.o
endif
iforce.o: $(IFORCEOBJS)
$(LD) -i $(IFORCEOBJS) -o $@
This diff is collapsed.
This diff is collapsed.
/*
* $Id: iforce-packets.c,v 1.15 2002/06/09 11:08:04 jdeneux Exp $
*
* Copyright (c) 2000-2002 Vojtech Pavlik <vojtech@ucw.cz>
* Copyright (c) 2001-2002 Johann Deneux <deneux@ifrance.com>
*
* USB/RS232 I-Force joysticks and wheels.
*/
/*
* 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. 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Should you need to contact me, the author, you can do so either by
* e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
* Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
*/
#include "iforce.h"
static struct {
__s32 x;
__s32 y;
} iforce_hat_to_axis[16] = {{ 0,-1}, { 1,-1}, { 1, 0}, { 1, 1}, { 0, 1}, {-1, 1}, {-1, 0}, {-1,-1}};
void iforce_dump_packet(char *msg, u16 cmd, unsigned char *data)
{
int i;
printk(KERN_DEBUG "iforce.c: %s ( cmd = %04x, data = ", msg, cmd);
for (i = 0; i < LO(cmd); i++)
printk("%02x ", data[i]);
printk(")\n");
}
/*
* Send a packet of bytes to the device
*/
int iforce_send_packet(struct iforce *iforce, u16 cmd, unsigned char* data)
{
/* Copy data to buffer */
int n = LO(cmd);
int c;
int empty;
int head, tail;
unsigned long flags;
/*
* Update head and tail of xmit buffer
*/
spin_lock_irqsave(&iforce->xmit_lock, flags);
head = iforce->xmit.head;
tail = iforce->xmit.tail;
if (CIRC_SPACE(head, tail, XMIT_SIZE) < n+2) {
printk(KERN_WARNING "iforce.c: not enough space in xmit buffer to send new packet\n");
spin_unlock_irqrestore(&iforce->xmit_lock, flags);
return -1;
}
empty = head == tail;
XMIT_INC(iforce->xmit.head, n+2);
/*
* Store packet in xmit buffer
*/
iforce->xmit.buf[head] = HI(cmd);
XMIT_INC(head, 1);
iforce->xmit.buf[head] = LO(cmd);
XMIT_INC(head, 1);
c = CIRC_SPACE_TO_END(head, tail, XMIT_SIZE);
if (n < c) c=n;
memcpy(&iforce->xmit.buf[head],
data,
c);
if (n != c) {
memcpy(&iforce->xmit.buf[0],
data + c,
n - c);
}
XMIT_INC(head, n);
spin_unlock_irqrestore(&iforce->xmit_lock, flags);
/*
* If necessary, start the transmission
*/
switch (iforce->bus) {
#ifdef IFORCE_232
case IFORCE_232:
if (empty)
iforce_serial_xmit(iforce);
break;
#endif
#ifdef IFORCE_USB
case IFORCE_USB:
if (iforce->usbdev && empty &&
!test_and_set_bit(IFORCE_XMIT_RUNNING, iforce->xmit_flags)) {
iforce_usb_xmit(iforce);
}
break;
#endif
}
return 0;
}
/* Start or stop an effect */
int iforce_control_playback(struct iforce* iforce, u16 id, unsigned int value)
{
unsigned char data[3];
printk(KERN_DEBUG "iforce-packets.c: control_playback %d %d\n", id, value);
data[0] = LO(id);
data[1] = (value > 0) ? ((value > 1) ? 0x41 : 0x01) : 0;
data[2] = LO(value);
return iforce_send_packet(iforce, FF_CMD_PLAY, data);
}
/* Mark an effect that was being updated as ready. That means it can be updated
* again */
static int mark_core_as_ready(struct iforce *iforce, unsigned short addr)
{
int i;
for (i=0; i<iforce->dev.ff_effects_max; ++i) {
if (test_bit(FF_CORE_IS_USED, iforce->core_effects[i].flags) &&
(iforce->core_effects[i].mod1_chunk.start == addr ||
iforce->core_effects[i].mod2_chunk.start == addr)) {
clear_bit(FF_CORE_UPDATE, iforce->core_effects[i].flags);
return 0;
}
}
printk(KERN_WARNING "iforce-packets.c: unused effect %04x updated !!!\n", addr);
return -1;
}
void iforce_process_packet(struct iforce *iforce, u16 cmd, unsigned char *data)
{
struct input_dev *dev = &iforce->dev;
int i;
static int being_used = 0;
if (being_used)
printk(KERN_WARNING "iforce-packets.c: re-entrant call to iforce_process %d\n", being_used);
being_used++;
#ifdef IFORCE_232
if (HI(iforce->expect_packet) == HI(cmd)) {
iforce->expect_packet = 0;
iforce->ecmd = cmd;
memcpy(iforce->edata, data, IFORCE_MAX_LENGTH);
if (waitqueue_active(&iforce->wait))
wake_up(&iforce->wait);
}
#endif
if (!iforce->type) {
being_used--;
return;
}
switch (HI(cmd)) {
case 0x01: /* joystick position data */
case 0x03: /* wheel position data */
if (HI(cmd) == 1) {
input_report_abs(dev, ABS_X, (__s16) (((__s16)data[1] << 8) | data[0]));
input_report_abs(dev, ABS_Y, (__s16) (((__s16)data[3] << 8) | data[2]));
input_report_abs(dev, ABS_THROTTLE, 255 - data[4]);
if (LO(cmd) >= 8 && test_bit(ABS_RUDDER ,dev->absbit))
input_report_abs(dev, ABS_RUDDER, (__s8)data[7]);
} else {
input_report_abs(dev, ABS_WHEEL, (__s16) (((__s16)data[1] << 8) | data[0]));
input_report_abs(dev, ABS_GAS, 255 - data[2]);
input_report_abs(dev, ABS_BRAKE, 255 - data[3]);
}
input_report_abs(dev, ABS_HAT0X, iforce_hat_to_axis[data[6] >> 4].x);
input_report_abs(dev, ABS_HAT0Y, iforce_hat_to_axis[data[6] >> 4].y);
for (i = 0; iforce->type->btn[i] >= 0; i++)
input_report_key(dev, iforce->type->btn[i], data[(i >> 3) + 5] & (1 << (i & 7)));
/* If there are untouched bits left, interpret them as the second hat */
if (i <= 8) {
int btns = data[6];
if (test_bit(ABS_HAT1X, dev->absbit)) {
if (btns & 8) input_report_abs(dev, ABS_HAT1X, -1);
else if (btns & 2) input_report_abs(dev, ABS_HAT1X, 1);
else input_report_abs(dev, ABS_HAT1X, 0);
}
if (test_bit(ABS_HAT1Y, dev->absbit)) {
if (btns & 1) input_report_abs(dev, ABS_HAT1Y, -1);
else if (btns & 4) input_report_abs(dev, ABS_HAT1Y, 1);
else input_report_abs(dev, ABS_HAT1Y, 0);
}
}
break;
case 0x02: /* status report */
input_report_key(dev, BTN_DEAD, data[0] & 0x02);
/* Check if an effect was just started or stopped */
i = data[1] & 0x7f;
if (data[1] & 0x80) {
if (!test_and_set_bit(FF_CORE_IS_PLAYED, iforce->core_effects[i].flags)) {
/* Report play event */
input_report_ff_status(dev, i, FF_STATUS_PLAYING);
}
}
else if (test_and_clear_bit(FF_CORE_IS_PLAYED, iforce->core_effects[i].flags)) {
/* Report stop event */
input_report_ff_status(dev, i, FF_STATUS_STOPPED);
}
if (LO(cmd) > 3) {
int j;
for (j=3; j<LO(cmd); j+=2) {
mark_core_as_ready(iforce, data[j] | (data[j+1]<<8));
}
}
break;
}
being_used--;
}
int iforce_get_id_packet(struct iforce *iforce, char *packet)
{
DECLARE_WAITQUEUE(wait, current);
int timeout = HZ; /* 1 second */
switch (iforce->bus) {
case IFORCE_USB:
#ifdef IFORCE_USB
iforce->cr.bRequest = packet[0];
iforce->ctrl->dev = iforce->usbdev;
set_current_state(TASK_INTERRUPTIBLE);
add_wait_queue(&iforce->wait, &wait);
if (usb_submit_urb(iforce->ctrl, GFP_KERNEL)) {
set_current_state(TASK_RUNNING);
remove_wait_queue(&iforce->wait, &wait);
return -1;
}
while (timeout && iforce->ctrl->status == -EINPROGRESS)
timeout = schedule_timeout(timeout);
set_current_state(TASK_RUNNING);
remove_wait_queue(&iforce->wait, &wait);
if (!timeout) {
usb_unlink_urb(iforce->ctrl);
return -1;
}
#else
printk(KERN_ERR "iforce_get_id_packet: iforce->bus = USB!\n");
#endif
break;
case IFORCE_232:
#ifdef IFORCE_232
iforce->expect_packet = FF_CMD_QUERY;
iforce_send_packet(iforce, FF_CMD_QUERY, packet);
set_current_state(TASK_INTERRUPTIBLE);
add_wait_queue(&iforce->wait, &wait);
while (timeout && iforce->expect_packet)
timeout = schedule_timeout(timeout);
set_current_state(TASK_RUNNING);
remove_wait_queue(&iforce->wait, &wait);
if (!timeout) {
iforce->expect_packet = 0;
return -1;
}
#else
printk(KERN_ERR "iforce_get_id_packet: iforce->bus = SERIO!\n");
#endif
break;
default:
printk(KERN_ERR "iforce_get_id_packet: iforce->bus = %d\n",
iforce->bus);
break;
}
return -(iforce->edata[0] != packet[0]);
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -156,7 +156,7 @@ static void magellan_connect(struct serio *serio, struct serio_dev *dev) ...@@ -156,7 +156,7 @@ static void magellan_connect(struct serio *serio, struct serio_dev *dev)
magellan->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); magellan->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
for (i = 0; i < 9; i++) for (i = 0; i < 9; i++)
set_bit(magellan_buttons[i], &magellan->dev.keybit); set_bit(magellan_buttons[i], magellan->dev.keybit);
for (i = 0; i < 6; i++) { for (i = 0; i < 6; i++) {
t = magellan_axes[i]; t = magellan_axes[i];
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment