diff -Nru a/CREDITS b/CREDITS
--- a/CREDITS Thu Aug 1 14:17:36 2002
+++ b/CREDITS Thu Aug 1 14:17:36 2002
@@ -1337,6 +1337,12 @@
S: Provo, Utah 84606-5607
S: USA
+N: Marcel Holtmann
+E: marcel@holtmann.org
+W: http://www.holtmann.org
+D: Author of the Linux Bluetooth Subsystem PC Card drivers
+S: Germany
+
N: Rob W. W. Hooft
E: hooft@EMBL-Heidelberg.DE
D: Shared libs for graphics-tools and for the f2c compiler
diff -Nru a/Documentation/DocBook/Makefile b/Documentation/DocBook/Makefile
--- a/Documentation/DocBook/Makefile Thu Aug 1 14:17:40 2002
+++ b/Documentation/DocBook/Makefile Thu Aug 1 14:17:40 2002
@@ -88,9 +88,9 @@
IMG-parportbook2 := $(addprefix Documentation/DocBook/,$(IMG-parportbook))
EPS-parportbook := $(patsubst %.fig,%.eps, $(IMG-parportbook2))
PNG-parportbook := $(patsubst %.fig,%.png, $(IMG-parportbook2))
-Documentation/DocBook/parportbook.ps: $(EPS-parportbook)
-Documentation/DocBook/parportbook.html Documentation/DocBook/parportbook.pdf:\
- $(PNG-parportbook)
+Documentation/DocBook/parportbook.html: $(PNG-parportbook)
+Documentation/DocBook/parportbook.ps Documentation/DocBook/parportbook.pdf:\
+ $(EPS-parportbook)
###
# Rules to generate postscript, PDF and HTML
@@ -99,48 +99,44 @@
@(which db2ps > /dev/null 2>&1) || \
(echo "*** You need to install DocBook stylesheets ***"; \
exit 1)
- @echo ' DB2PS $@'
- @db2ps -o $(dir $@) $<
+ $(call do_cmd,DB2PS $@,db2ps -o $(dir $@) $<)
%.pdf : %.sgml
@(which db2pdf > /dev/null 2>&1) || \
(echo "*** You need to install DocBook stylesheets ***"; \
exit 1)
- @echo ' DB2PDF $@'
- @db2pdf -o $(dir $@) $<
+ $(call do_cmd,DB2PDF $@,db2pdf -o $(dir $@) $<)
%.html: %.sgml
@(which db2html > /dev/null 2>&1) || \
(echo "*** You need to install DocBook stylesheets ***"; \
exit 1)
@rm -rf $@ $(patsubst %.html,%,$@)
- @echo ' DB2HTML $@'
- @db2html -o $(patsubst %.html,%,$@) $< && \
+ $(call do_cmd,DB2HTML $@,db2html -o $(patsubst %.html,%,$@) $< && \
echo '\
- Goto $(patsubst %.html,%,$(notdir $@))
' > $@
+ Goto $(patsubst %.html,%,$(notdir $@))
' > $@)
@if [ ! -z "$(PNG-$(basename $(notdir $@)))" ]; then \
cp $(PNG-$(basename $(notdir $@))) $(patsubst %.html,%,$@); fi
###
# Rules to generate postscripts and PNG imgages from .fig format files
%.eps: %.fig
- @echo ' FIG2DEV -Leps $@'
- @fig2dev -Leps $< $@
+ $(call do_cmd,FIG2DEV -Leps $@,fig2dev -Leps $< $@)
%.png: %.fig
- @echo ' FIG2DEV -Lpng $@'
- fig2dev -Lpng $< $@
+ $(call do_cmd,FIG2DEV -Lpng $@,fig2dev -Lpng $< $@)
###
# Rule to convert a .c file to inline SGML documentation
%.sgml: %.c
@echo ' Generating $@'
- @echo "" > $@
- @expand --tabs=8 < $< | \
- sed -e "s/&/\\&/g" \
- -e "s/\\</g" \
- -e "s/>/\\>/g" >> $@
- @echo "" >> $@
+ @( \
+ echo ""; \
+ expand --tabs=8 < $< | \
+ sed -e "s/&/\\&/g" \
+ -e "s/\\</g" \
+ -e "s/>/\\>/g"; \
+ echo "") > $@
###
# Help targets as used by the top-level makefile
diff -Nru a/Documentation/filesystems/devfs/ChangeLog b/Documentation/filesystems/devfs/ChangeLog
--- a/Documentation/filesystems/devfs/ChangeLog Thu Aug 1 14:17:36 2002
+++ b/Documentation/filesystems/devfs/ChangeLog Thu Aug 1 14:17:36 2002
@@ -1941,3 +1941,19 @@
- Updated README from master HTML file
- Fixed devfs entry leak in when *readdir fails
+===============================================================================
+Changes for patch v215
+
+- Created
+
+- Switched many functions from to
+
+
+- Switched many functions from to
+===============================================================================
+Changes for patch v216
+
+- Switched arch/ia64/sn/io/hcl.c from to
+
+
+- Removed deprecated
diff -Nru a/Documentation/ide.txt b/Documentation/ide.txt
--- a/Documentation/ide.txt Thu Aug 1 14:17:36 2002
+++ b/Documentation/ide.txt Thu Aug 1 14:17:36 2002
@@ -1,9 +1,6 @@
-
-
Information regarding the Enhanced IDE drive in Linux 2.5
-
==============================================================================
@@ -49,7 +46,7 @@
- If you mix devices on the same cable, please consider using similar devices
in respect of the data transfer mode they support.
-- Even better tru to stick to the same vendor and device type on the same
+- Even better try to stick to the same vendor and device type on the same
cable.
================================================================================
@@ -69,7 +66,8 @@
To access devices on interfaces > ide0, device entries please make sure that
device files for them are present in /dev. If not, please create such
entries, by simply running the included shell script:
-/usr/src/linux/scripts/MAKEDEV.ide
+
+ /usr/src/linux/scripts/MAKEDEV.ide
This driver automatically probes for most IDE interfaces (including all PCI
ones), for the drives/geometries attached to those interfaces, and for the IRQ
@@ -195,11 +193,10 @@
under control of ide.c. To have ide.c also "take over" the primary
IDE port in this situation, use the "command line" parameter: ide0=0x1f0
-The IDE driver is partly modularized. The high level disk/cdrom/tape/floppy
+The IDE driver is modularized. The high level disk/CD-ROM/tape/floppy
drivers can always be compiled as loadable modules, the chipset drivers
can only be compiled into the kernel, and the core code (ide.c) can be
-compiled as a loadable module provided no chipset support and no special
-partition table translations are needed.
+compiled as a loadable module provided no chipset support is needed.
When using ide.c/ide-tape.c as modules in combination with kerneld, add:
@@ -217,8 +214,9 @@
================================================================================
-Summary of ide driver parameters for kernel "command line":
-----------------------------------------------------------
+Summary of ide driver parameters for kernel command line
+--------------------------------------------------------
+
"hdx=" is recognized for all "x" from "a" to "h", such as "hdc".
"idex=" is recognized for all "x" from "0" to "3", such as "ide1".
@@ -300,6 +298,53 @@
There may be more options than shown -- use the source, Luke!
Everything else is rejected with a "BAD OPTION" message.
+
+================================================================================
+
+IDE ATAPI streaming tape driver
+-------------------------------
+
+This driver is a part of the Linux ide driver and works in co-operation
+with linux/drivers/block/ide.c.
+
+The driver, in co-operation with ide.c, basically traverses the
+request-list for the block device interface. The character device
+interface, on the other hand, creates new requests, adds them
+to the request-list of the block device, and waits for their completion.
+
+Pipelined operation mode is now supported on both reads and writes.
+
+The block device major and minor numbers are determined from the
+tape's relative position in the ide interfaces, as explained in ide.c.
+
+The character device interface consists of the following devices:
+
+ ht0 major 37, minor 0 first IDE tape, rewind on close.
+ ht1 major 37, minor 1 second IDE tape, rewind on close.
+ ...
+ nht0 major 37, minor 128 first IDE tape, no rewind on close.
+ nht1 major 37, minor 129 second IDE tape, no rewind on close.
+ ...
+
+Run linux/scripts/MAKEDEV.ide to create the above entries.
+
+The general magnetic tape commands compatible interface, as defined by
+include/linux/mtio.h, is accessible through the character device.
+
+General ide driver configuration options, such as the interrupt-unmask
+flag, can be configured by issuing an ioctl to the block device interface,
+as any other ide device.
+
+Our own ide-tape ioctl's can be issued to either the block device or
+the character device interface.
+
+Maximal throughput with minimal bus load will usually be achieved in the
+following scenario:
+
+ 1. ide-tape is operating in the pipelined operation mode.
+ 2. No buffering is performed by the user backup program.
+
+
================================================================================
diff -Nru a/Documentation/serial/driver b/Documentation/serial/driver
--- a/Documentation/serial/driver Thu Aug 1 14:17:36 2002
+++ b/Documentation/serial/driver Thu Aug 1 14:17:36 2002
@@ -138,15 +138,16 @@
Stop receiving characters; the port is in the process of
being closed.
- Locking: none.
- Interrupts: caller dependent.
+ Locking: port->lock taken.
+ Interrupts: locally disabled.
This call must not sleep
enable_ms(port)
Enable the modem status interrupts.
- Locking: none.
- Interrupts: caller dependent.
+ Locking: port->lock taken.
+ Interrupts: locally disabled.
+ This call must not sleep
break_ctl(port,ctl)
Control the transmission of a break signal. If ctl is
diff -Nru a/Documentation/sysctl/vm.txt b/Documentation/sysctl/vm.txt
--- a/Documentation/sysctl/vm.txt Thu Aug 1 14:17:41 2002
+++ b/Documentation/sysctl/vm.txt Thu Aug 1 14:17:41 2002
@@ -16,7 +16,6 @@
files can be found in mm/swap.c.
Currently, these files are in /proc/sys/vm:
-- kswapd
- overcommit_memory
- page-cluster
- dirty_async_ratio
@@ -34,39 +33,6 @@
==============================================================
-kswapd:
-
-Kswapd is the kernel swapout daemon. That is, kswapd is that
-piece of the kernel that frees memory when it gets fragmented
-or full. Since every system is different, you'll probably want
-some control over this piece of the system.
-
-The numbers in this page correspond to the numbers in the
-struct pager_daemon {tries_base, tries_min, swap_cluster
-}; The tries_base and swap_cluster probably have the
-largest influence on system performance.
-
-tries_base The maximum number of pages kswapd tries to
- free in one round is calculated from this
- number. Usually this number will be divided
- by 4 or 8 (see mm/vmscan.c), so it isn't as
- big as it looks.
- When you need to increase the bandwidth to/from
- swap, you'll want to increase this number.
-tries_min This is the minimum number of times kswapd
- tries to free a page each time it is called.
- Basically it's just there to make sure that
- kswapd frees some pages even when it's being
- called with minimum priority.
-swap_cluster This is the number of pages kswapd writes in
- one turn. You want this large so that kswapd
- does it's I/O in large chunks and the disk
- doesn't have to seek often, but you don't want
- it to be too large since that would flood the
- request queue.
-
-==============================================================
-
overcommit_memory:
This value contains a flag that enables memory overcommitment.
@@ -78,7 +44,21 @@
programs that malloc() huge amounts of memory "just-in-case"
and don't use much of it.
-Look at: mm/mmap.c::vm_enough_memory() for more information.
+A value of 2 introduces a new "strict overcommit" policy
+that attempts to prevent any overcommit of memory.
+
+The default value is 0.
+
+See Documentation/vm/overcommit-accounting and
+mm/mmap.c::vm_enough_memory() for more information.
+
+==============================================================
+
+overcommit_ratio:
+
+When overcommit_memory is set to 2, the committed address
+space is not permitted to exceed swap plus this percentage
+of physical RAM. See above.
==============================================================
diff -Nru a/Documentation/vm/overcommit-accounting b/Documentation/vm/overcommit-accounting
--- /dev/null Wed Dec 31 16:00:00 1969
+++ b/Documentation/vm/overcommit-accounting Thu Aug 1 14:17:41 2002
@@ -0,0 +1,68 @@
+The Linux kernel supports four overcommit handling modes
+
+0 - Heuristic overcommit handling. Obvious overcommits of
+ address space are refused. Used for a typical system. It
+ ensures a seriously wild allocation fails while allowing
+ overcommit to reduce swap usage. This is the default.
+
+1 - No overcommit handling. Appropriate for some scientific
+ applications.
+
+2 - (NEW) strict overcommit. The total address space commit
+ for the system is not permitted to exceed swap + a
+ configurable percentage (default is 50) of physical RAM.
+ Depending on the percentage you use, in most situations
+ this means a process will not be killed while accessing
+ pages but will receive errors on memory allocation as
+ appropriate.
+
+The overcommit policy is set via the sysctl `vm.overcommit_memory'.
+
+The overcommit percentage is set via `vm.overcommit_ratio'.
+
+Gotchas
+-------
+
+The C language stack growth does an implicit mremap. If you want absolute
+guarantees and run close to the edge you MUST mmap your stack for the
+largest size you think you will need. For typical stack usage is does
+not matter much but its a corner case if you really really care
+
+In mode 2 the MAP_NORESERVE flag is ignored.
+
+
+How It Works
+------------
+
+The overcommit is based on the following rules
+
+For a file backed map
+ SHARED or READ-only - 0 cost (the file is the map not swap)
+ PRIVATE WRITABLE - size of mapping per instance
+
+For an anonymous or /dev/zero map
+ SHARED - size of mapping
+ PRIVATE READ-only - 0 cost (but of little use)
+ PRIVATE WRITABLE - size of mapping per instance
+
+Additional accounting
+ Pages made writable copies by mmap
+ shmfs memory drawn from the same pool
+
+Status
+------
+
+o We account mmap memory mappings
+o We account mprotect changes in commit
+o We account mremap changes in size
+o We account brk
+o We account munmap
+o We report the commit status in /proc
+o Account and check on fork
+o Review stack handling/building on exec
+o SHMfs accounting
+o Implement actual limit enforcement
+
+To Do
+-----
+o Account ptrace pages (this is hard)
diff -Nru a/MAINTAINERS b/MAINTAINERS
--- a/MAINTAINERS Thu Aug 1 14:17:40 2002
+++ b/MAINTAINERS Thu Aug 1 14:17:40 2002
@@ -270,6 +270,12 @@
W: http://bluez.sf.net
S: Maintained
+BLUETOOTH SUBSYSTEM (PC Card Drivers)
+P: Marcel Holtmann
+M: marcel@holtmann.org
+W: http://www.holtmann.org/linux/bluetooth/
+S: Maintained
+
BTTV VIDEO4LINUX DRIVER
P: Gerd Knorr
M: kraxel@bytesex.org
@@ -1487,7 +1493,7 @@
L: alsa-devel@alsa-project.org
S: Maintained
-SPARC:
+UltraSPARC (sparc64):
P: David S. Miller
M: davem@redhat.com
P: Eddie C. Dost
@@ -1499,6 +1505,9 @@
L: sparclinux@vger.kernel.org
L: ultralinux@vger.kernel.org
S: Maintained
+
+SPARC (sparc32):
+S: Unmaintained
SPECIALIX IO8+ MULTIPORT SERIAL CARD DRIVER
P: Roger Wolff
diff -Nru a/Makefile b/Makefile
--- a/Makefile Thu Aug 1 14:17:36 2002
+++ b/Makefile Thu Aug 1 14:17:36 2002
@@ -1,6 +1,6 @@
VERSION = 2
PATCHLEVEL = 5
-SUBLEVEL = 29
+SUBLEVEL = 30
EXTRAVERSION =
# *DOCUMENTATION*
@@ -279,7 +279,6 @@
mv -f .tmpversion .version
+$(MAKE) -C init
$(call cmd,link_vmlinux)
- $(cmd_link_vmlinux)
echo 'cmd_$@ := $(cmd_link_vmlinux)' > $(@D)/.$(@F).cmd
$(NM) vmlinux | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | sort > System.map
endef
diff -Nru a/Rules.make b/Rules.make
--- a/Rules.make Thu Aug 1 14:17:40 2002
+++ b/Rules.make Thu Aug 1 14:17:40 2002
@@ -553,3 +553,22 @@
# If quiet is set, only print short version of command
cmd = @$(if $($(quiet)cmd_$(1)),echo ' $($(quiet)cmd_$(1))' &&) $(cmd_$(1))
+
+# do_cmd is a shorthand used to support both compressed, verbose
+# and silent output in a single line.
+# Compared to cmd described avobe, do_cmd does no rely on any variables
+# previously assigned a value.
+#
+# Usage $(call do_cmd,CMD $@,cmd_to_execute bla bla)
+# Example:
+# $(call do_cmd,CP $@,cp -b $< $@)
+# make -s => nothing will be printed
+# make KBUILD_VERBOSE=1 => cp -b path/to/src.file path/to/dest.file
+# make KBUILD_VERBOSE=0 => CP path/to/dest.file
+define do_cmd
+ @$(if $(filter quiet_,$(quiet)), echo ' $(1)' &&,
+ $(if $(filter silent_,$(quiet)),,
+ echo "$(2)" &&)) \
+ $(2)
+endef
+
diff -Nru a/arch/alpha/kernel/entry.S b/arch/alpha/kernel/entry.S
--- a/arch/alpha/kernel/entry.S Thu Aug 1 14:17:36 2002
+++ b/arch/alpha/kernel/entry.S Thu Aug 1 14:17:36 2002
@@ -1081,8 +1081,8 @@
.quad sys_pciconfig_write
.quad sys_query_module
.quad sys_prctl
- .quad sys_pread
- .quad sys_pwrite /* 350 */
+ .quad sys_pread64
+ .quad sys_pwrite64 /* 350 */
.quad sys_rt_sigreturn
.quad sys_rt_sigaction
.quad sys_rt_sigprocmask
diff -Nru a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c
--- a/arch/alpha/kernel/osf_sys.c Thu Aug 1 14:17:36 2002
+++ b/arch/alpha/kernel/osf_sys.c Thu Aug 1 14:17:36 2002
@@ -221,8 +221,8 @@
* isn't actually going to matter, as if the parent happens
* to change we can happily return either of the pids.
*/
- (®s)->r20 = tsk->real_parent->pid;
- return tsk->pid;
+ (®s)->r20 = tsk->real_parent->tgid;
+ return tsk->tgid;
}
asmlinkage unsigned long osf_mmap(unsigned long addr, unsigned long len,
diff -Nru a/arch/arm/kernel/calls.S b/arch/arm/kernel/calls.S
--- a/arch/arm/kernel/calls.S Thu Aug 1 14:17:40 2002
+++ b/arch/arm/kernel/calls.S Thu Aug 1 14:17:40 2002
@@ -194,8 +194,8 @@
.long sys_rt_sigtimedwait
.long sys_rt_sigqueueinfo
.long sys_rt_sigsuspend_wrapper
-/* 180 */ .long sys_pread
- .long sys_pwrite
+/* 180 */ .long sys_pread64
+ .long sys_pwrite64
.long sys_chown16
.long sys_getcwd
.long sys_capget
@@ -237,7 +237,7 @@
/* 220 */ .long sys_madvise
.long sys_fcntl64
.long sys_ni_syscall /* TUX */
- .long sys_ni_syscall /* Security */
+ .long sys_security
.long sys_gettid
/* 225 */ .long sys_readahead
.long sys_setxattr
diff -Nru a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S
--- a/arch/arm/kernel/entry-armv.S Thu Aug 1 14:17:39 2002
+++ b/arch/arm/kernel/entry-armv.S Thu Aug 1 14:17:39 2002
@@ -725,7 +725,7 @@
msr cpsr_c, r9
mov r2, sp
bl do_DataAbort
- set_cpsr_c r0, #PSR_I_BIT | MODE_SVC
+ disable_irq r0
ldr r0, [sp, #S_PSR]
msr spsr, r0
ldmia sp, {r0 - pc}^ @ load r0 - pc, cpsr
@@ -776,9 +776,9 @@
movne pc, lr
mov r7, #PREEMPT_ACTIVE
str r7, [r8, #TI_PREEMPT] @ set PREEMPT_ACTIVE
-1: set_cpsr_c r2, #MODE_SVC @ enable IRQs
+1: enable_irq r2 @ enable IRQs
bl schedule
- set_cpsr_c r0, #PSR_I_BIT | MODE_SVC @ disable IRQs
+ disable_irq r0 @ disable IRQs
ldr r0, [r8, #TI_FLAGS] @ get new tasks TI_FLAGS
tst r0, #_TIF_NEED_RESCHED
beq preempt_return @ go again
@@ -801,7 +801,7 @@
mov r0, sp @ struct pt_regs *regs
bl do_undefinstr
-1: set_cpsr_c r0, #PSR_I_BIT | MODE_SVC
+1: disable_irq r0
ldr lr, [sp, #S_PSR] @ Get SVC cpsr
msr spsr, lr
ldmia sp, {r0 - pc}^ @ Restore SVC registers
@@ -822,7 +822,7 @@
mov r0, r2 @ address (pc)
mov r1, sp @ regs
bl do_PrefetchAbort @ call abort handler
- set_cpsr_c r0, #PSR_I_BIT | MODE_SVC
+ disable_irq r0
ldr r0, [sp, #S_PSR]
msr spsr, r0
ldmia sp, {r0 - pc}^ @ load r0 - pc, cpsr
@@ -861,7 +861,7 @@
#else
bl CPU_ABORT_HANDLER
#endif
- set_cpsr_c r2, #MODE_SVC @ Enable interrupts
+ enable_irq r2 @ Enable interrupts
mov r2, sp
adrsvc al, lr, ret_from_exception
b do_DataAbort
@@ -916,7 +916,7 @@
adrsvc al, r9, ret_from_exception @ r9 = normal FP return
adrsvc al, lr, fpundefinstr @ lr = undefined instr return
-call_fpe: set_cpsr_c r0, #MODE_SVC @ Enable interrupts
+call_fpe: enable_irq r0 @ Enable interrupts
get_thread_info r10 @ get current thread
ldr r4, [r10, #TI_TASK] @ get current task
mov r8, #1
@@ -939,7 +939,7 @@
stmdb r8, {sp, lr}^ @ Save sp_usr lr_usr
alignment_trap r4, r7, __temp_abt
zero_fp
- set_cpsr_c r0, #MODE_SVC @ Enable interrupts
+ enable_irq r0 @ Enable interrupts
mov r0, r5 @ address (pc)
mov r1, sp @ regs
bl do_PrefetchAbort @ call abort handler
diff -Nru a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S
--- a/arch/arm/kernel/entry-common.S Thu Aug 1 14:17:36 2002
+++ b/arch/arm/kernel/entry-common.S Thu Aug 1 14:17:36 2002
@@ -35,18 +35,27 @@
* stack.
*/
ret_fast_syscall:
- set_cpsr_c r1, #PSR_I_BIT | MODE_SVC @ disable interrupts
+ disable_irq r1 @ disable interrupts
ldr r1, [tsk, #TI_FLAGS]
tst r1, #_TIF_WORK_MASK
- bne ret_fast_work
+ bne fast_work_pending
fast_restore_user_regs
/*
* Ok, we need to do extra processing, enter the slow path.
*/
-ret_fast_work:
- str r0, [sp, #S_R0+S_OFF]! @ returned r0
- b work_pending
+fast_work_pending:
+ str r0, [sp, #S_R0+S_OFF]! @ returned r0
+work_pending:
+ tst r1, #_TIF_NEED_RESCHED
+ bne work_resched
+ tst r1, #_TIF_NOTIFY_RESUME | _TIF_SIGPENDING
+ beq no_work_pending
+ mov r0, sp @ 'regs'
+ mov r2, why @ 'syscall'
+ bl do_notify_resume
+ disable_irq r1 @ disable interrupts
+ b no_work_pending
work_resched:
bl schedule
@@ -55,22 +64,12 @@
*/
ENTRY(ret_to_user)
ret_slow_syscall:
- set_cpsr_c r1, #PSR_I_BIT | MODE_SVC @ disable interrupts
+ disable_irq r1 @ disable interrupts
ldr r1, [tsk, #TI_FLAGS]
tst r1, #_TIF_WORK_MASK
- beq no_work_pending
-work_pending:
- tst r1, #_TIF_NEED_RESCHED
- bne work_resched
- tst r1, #_TIF_NOTIFY_RESUME | _TIF_SIGPENDING
- blne __do_notify_resume
+ bne work_pending
no_work_pending:
- restore_user_regs
-
-__do_notify_resume:
- mov r0, sp @ 'regs'
- mov r2, why @ 'syscall'
- b do_notify_resume @ note the bl above sets lr
+ slow_restore_user_regs
/*
* This is how we return from a fork.
@@ -80,9 +79,9 @@
bl schedule_tail
#endif
get_thread_info tsk
- ldr ip, [tsk, #TI_FLAGS] @ check for syscall tracing
+ ldr r1, [tsk, #TI_FLAGS] @ check for syscall tracing
mov why, #1
- tst ip, #_TIF_SYSCALL_TRACE @ are we tracing syscalls?
+ tst r1, #_TIF_SYSCALL_TRACE @ are we tracing syscalls?
beq ret_slow_syscall
mov r1, sp
mov r0, #1 @ trace exit [IP = 1]
@@ -134,7 +133,7 @@
ldr ip, [ip]
mcr p15, 0, ip, c1, c0 @ update control register
#endif
- enable_irqs ip
+ enable_irq ip
str r4, [sp, #-S_OFF]! @ push fifth arg
diff -Nru a/arch/arm/kernel/entry-header.S b/arch/arm/kernel/entry-header.S
--- a/arch/arm/kernel/entry-header.S Thu Aug 1 14:17:40 2002
+++ b/arch/arm/kernel/entry-header.S Thu Aug 1 14:17:40 2002
@@ -11,13 +11,13 @@
#define MODE_SVC 0x13
#endif
- .macro zero_fp
+ .macro zero_fp
#ifndef CONFIG_NO_FRAME_POINTER
- mov fp, #0
+ mov fp, #0
#endif
- .endm
+ .endm
- .text
+ .text
@ Bad Abort numbers
@ -----------------
@@ -69,119 +69,146 @@
#define S_OFF 8
#ifdef CONFIG_CPU_32
- .macro save_user_regs
- sub sp, sp, #S_FRAME_SIZE
- stmia sp, {r0 - r12} @ Calling r0 - r12
- add r8, sp, #S_PC
- stmdb r8, {sp, lr}^ @ Calling sp, lr
- mrs r8, spsr @ called from non-FIQ mode, so ok.
- str lr, [sp, #S_PC] @ Save calling PC
- str r8, [sp, #S_PSR] @ Save CPSR
- str r0, [sp, #S_OLD_R0] @ Save OLD_R0
- .endm
-
- .macro restore_user_regs
- ldr r0, [sp, #S_PSR] @ Get calling cpsr
- mov ip, #PSR_I_BIT | MODE_SVC
- msr cpsr_c, ip @ disable IRQs
- msr spsr, r0 @ save in spsr_svc
- ldr lr, [sp, #S_PC] @ Get PC
- ldmia sp, {r0 - lr}^ @ Get calling r0 - lr
- mov r0, r0
- add sp, sp, #S_FRAME_SIZE
- movs pc, lr @ return & move spsr_svc into cpsr
- .endm
-
- .macro fast_restore_user_regs
- mov ip, #PSR_I_BIT | MODE_SVC
- msr cpsr_c, ip @ disable IRQs
- ldr r1, [sp, #S_OFF + S_PSR] @ get calling cpsr
- ldr lr, [sp, #S_OFF + S_PC]! @ get pc
- msr spsr, r1 @ save in spsr_svc
- ldmdb sp, {r1 - lr}^ @ get calling r1 - lr
- mov r0, r0
- add sp, sp, #S_FRAME_SIZE - S_PC
- movs pc, lr @ return & move spsr_svc into cpsr
- .endm
-
- .macro mask_pc, rd, rm
- .endm
-
- .macro enable_irqs, temp
- mov \temp, #MODE_SVC
- msr cpsr_c, \temp
- .endm
-
- .macro get_thread_info, rd
- mov \rd, sp, lsr #13
- mov \rd, \rd, lsl #13
- .endm
-
- /*
- * Like adr, but force SVC mode (if required)
- */
- .macro adrsvc, cond, reg, label
- adr\cond \reg, \label
- .endm
- .macro alignment_trap, rbase, rtemp, sym
+ .macro set_cpsr_c, reg, mode
+#if 1
+ /* broken binutils */
+ mov \reg, \mode
+ msr cpsr_c, \reg
+#else
+ msr cpsr_c, \mode
+#endif
+ .endm
+
+ .macro disable_irq, temp
+ set_cpsr_c \temp, #PSR_I_BIT | MODE_SVC
+ .endm
+
+ .macro enable_irq, temp
+ set_cpsr_c \temp, #MODE_SVC
+ .endm
+
+ .macro save_user_regs
+ sub sp, sp, #S_FRAME_SIZE
+ stmia sp, {r0 - r12} @ Calling r0 - r12
+ add r8, sp, #S_PC
+ stmdb r8, {sp, lr}^ @ Calling sp, lr
+ mrs r8, spsr @ called from non-FIQ mode, so ok.
+ str lr, [sp, #S_PC] @ Save calling PC
+ str r8, [sp, #S_PSR] @ Save CPSR
+ str r0, [sp, #S_OLD_R0] @ Save OLD_R0
+ .endm
+
+ .macro restore_user_regs
+ ldr r1, [sp, #S_PSR] @ Get calling cpsr
+ disable_irq ip @ disable IRQs
+ ldr lr, [sp, #S_PC]! @ Get PC
+ msr spsr, r1 @ save in spsr_svc
+ ldmdb sp, {r0 - lr}^ @ Get calling r0 - lr
+ mov r0, r0
+ add sp, sp, #S_FRAME_SIZE - S_PC
+ movs pc, lr @ return & move spsr_svc into cpsr
+ .endm
+
+/*
+ * Must be called with IRQs already disabled.
+ */
+ .macro fast_restore_user_regs
+ ldr r1, [sp, #S_OFF + S_PSR] @ get calling cpsr
+ ldr lr, [sp, #S_OFF + S_PC]! @ get pc
+ msr spsr, r1 @ save in spsr_svc
+ ldmdb sp, {r1 - lr}^ @ get calling r1 - lr
+ mov r0, r0
+ add sp, sp, #S_FRAME_SIZE - S_PC
+ movs pc, lr @ return & move spsr_svc into cpsr
+ .endm
+
+/*
+ * Must be called with IRQs already disabled.
+ */
+ .macro slow_restore_user_regs
+ ldr r1, [sp, #S_PSR] @ get calling cpsr
+ ldr lr, [sp, #S_PC]! @ get pc
+ msr spsr, r1 @ save in spsr_svc
+ ldmdb sp, {r0 - lr}^ @ get calling r1 - lr
+ mov r0, r0
+ add sp, sp, #S_FRAME_SIZE - S_PC
+ movs pc, lr @ return & move spsr_svc into cpsr
+ .endm
+
+ .macro mask_pc, rd, rm
+ .endm
+
+ .macro get_thread_info, rd
+ mov \rd, sp, lsr #13
+ mov \rd, \rd, lsl #13
+ .endm
+
+/*
+ * Like adr, but force SVC mode (if required)
+ */
+ .macro adrsvc, cond, reg, label
+ adr\cond \reg, \label
+ .endm
+
+ .macro alignment_trap, rbase, rtemp, sym
#ifdef CONFIG_ALIGNMENT_TRAP
#define OFF_CR_ALIGNMENT(x) cr_alignment - x
- ldr \rtemp, [\rbase, #OFF_CR_ALIGNMENT(\sym)]
- mcr p15, 0, \rtemp, c1, c0
+ ldr \rtemp, [\rbase, #OFF_CR_ALIGNMENT(\sym)]
+ mcr p15, 0, \rtemp, c1, c0
#endif
- .endm
+ .endm
#else
- .macro save_user_regs
- str r0, [sp, #-4]!
- str lr, [sp, #-4]!
- sub sp, sp, #15*4
- stmia sp, {r0 - lr}^
- mov r0, r0
- .endm
-
- .macro restore_user_regs
- ldmia sp, {r0 - lr}^
- mov r0, r0
- ldr lr, [sp, #15*4]
- add sp, sp, #15*4+8
- movs pc, lr
- .endm
-
- .macro fast_restore_user_regs
- add sp, sp, #S_OFF
- ldmib sp, {r1 - lr}^
- mov r0, r0
- ldr lr, [sp, #15*4]
- add sp, sp, #15*4+8
- movs pc, lr
- .endm
-
- .macro mask_pc, rd, rm
- bic \rd, \rm, #PCMASK
- .endm
-
- .macro enable_irqs, temp
- teqp pc, #0x00000003
- .endm
-
- .macro initialise_traps_extra
- .endm
-
- .macro get_thread_info, rd
- mov \rd, sp, lsr #13
- mov \rd, \rd, lsl #13
- .endm
-
- /*
- * Like adr, but force SVC mode (if required)
- */
- .macro adrsvc, cond, reg, label
- adr\cond \reg, \label
- orr\cond \reg, \reg, #0x08000003
- .endm
+ .macro save_user_regs
+ str r0, [sp, #-4]!
+ str lr, [sp, #-4]!
+ sub sp, sp, #15*4
+ stmia sp, {r0 - lr}^
+ mov r0, r0
+ .endm
+
+ .macro restore_user_regs
+ ldmia sp, {r0 - lr}^
+ mov r0, r0
+ ldr lr, [sp, #15*4]
+ add sp, sp, #15*4+8
+ movs pc, lr
+ .endm
+
+ .macro fast_restore_user_regs
+ add sp, sp, #S_OFF
+ ldmib sp, {r1 - lr}^
+ mov r0, r0
+ ldr lr, [sp, #15*4]
+ add sp, sp, #15*4+8
+ movs pc, lr
+ .endm
+
+ .macro mask_pc, rd, rm
+ bic \rd, \rm, #PCMASK
+ .endm
+
+ .macro enable_irqs, temp
+ teqp pc, #0x00000003
+ .endm
+
+ .macro initialise_traps_extra
+ .endm
+
+ .macro get_thread_info, rd
+ mov \rd, sp, lsr #13
+ mov \rd, \rd, lsl #13
+ .endm
+
+ /*
+ * Like adr, but force SVC mode (if required)
+ */
+ .macro adrsvc, cond, reg, label
+ adr\cond \reg, \label
+ orr\cond \reg, \reg, #0x08000003
+ .endm
#endif
@@ -215,13 +242,3 @@
ldr scno, [lr, #-4] @ get SWI instruction
#endif
.endm
-
- .macro set_cpsr_c, reg, mode
-#if 1
- mov \reg, \mode
- msr cpsr_c, \reg
-#else
- msr cpsr_c, \mode
-#endif
- .endm
-
diff -Nru a/arch/arm/kernel/irq.c b/arch/arm/kernel/irq.c
--- a/arch/arm/kernel/irq.c Thu Aug 1 14:17:36 2002
+++ b/arch/arm/kernel/irq.c Thu Aug 1 14:17:36 2002
@@ -217,14 +217,14 @@
desc->triggered = 1;
- irq_enter(cpu, irq);
+ irq_enter();
kstat.irqs[cpu][irq]++;
action = desc->action;
if (action)
__do_irq(irq, desc->action, regs);
- irq_exit(cpu, irq);
+ irq_exit();
}
/*
@@ -256,7 +256,7 @@
*/
desc->running = 1;
- irq_enter(cpu, irq);
+ irq_enter();
kstat.irqs[cpu][irq]++;
do {
@@ -274,7 +274,7 @@
__do_irq(irq, action, regs);
} while (desc->pending);
- irq_exit(cpu, irq);
+ irq_exit();
desc->running = 0;
@@ -311,7 +311,7 @@
desc->chip->ack(irq);
if (likely(desc->enabled)) {
- irq_enter(cpu, irq);
+ irq_enter();
kstat.irqs[cpu][irq]++;
/*
@@ -325,7 +325,7 @@
!check_irq_lock(desc, irq, regs)))
desc->chip->unmask(irq);
}
- irq_exit(cpu, irq);
+ irq_exit();
}
}
diff -Nru a/arch/arm/kernel/ptrace.c b/arch/arm/kernel/ptrace.c
--- a/arch/arm/kernel/ptrace.c Thu Aug 1 14:17:36 2002
+++ b/arch/arm/kernel/ptrace.c Thu Aug 1 14:17:36 2002
@@ -17,6 +17,7 @@
#include
#include
#include
+#include
#include
#include
@@ -654,6 +655,9 @@
if (request == PTRACE_TRACEME) {
/* are we already being traced? */
if (current->ptrace & PT_PTRACED)
+ goto out;
+ ret = security_ops->ptrace(current->parent, current);
+ if (ret)
goto out;
/* set the ptrace bit in the process flags. */
current->ptrace |= PT_PTRACED;
diff -Nru a/arch/arm/lib/kbd.c b/arch/arm/lib/kbd.c
--- a/arch/arm/lib/kbd.c Thu Aug 1 14:17:40 2002
+++ b/arch/arm/lib/kbd.c Thu Aug 1 14:17:40 2002
@@ -1,13 +1,279 @@
#include
#include
+#include
+#include
-int (*k_setkeycode)(unsigned int, unsigned int);
-int (*k_getkeycode)(unsigned int);
-int (*k_translate)(unsigned char, unsigned char *, char);
-char (*k_unexpected_up)(unsigned char);
+/*
+ * Translation of escaped scancodes to keycodes.
+ * This is now user-settable.
+ * The keycodes 1-88,96-111,119 are fairly standard, and
+ * should probably not be changed - changing might confuse X.
+ * X also interprets scancode 0x5d (KEY_Begin).
+ *
+ * For 1-88 keycode equals scancode.
+ */
+
+#define E0_KPENTER 96
+#define E0_RCTRL 97
+#define E0_KPSLASH 98
+#define E0_PRSCR 99
+#define E0_RALT 100
+#define E0_BREAK 101 /* (control-pause) */
+#define E0_HOME 102
+#define E0_UP 103
+#define E0_PGUP 104
+#define E0_LEFT 105
+#define E0_RIGHT 106
+#define E0_END 107
+#define E0_DOWN 108
+#define E0_PGDN 109
+#define E0_INS 110
+#define E0_DEL 111
+
+/* for USB 106 keyboard */
+#define E0_YEN 124
+#define E0_BACKSLASH 89
+
+
+#define E1_PAUSE 119
+
+/*
+ * The keycodes below are randomly located in 89-95,112-118,120-127.
+ * They could be thrown away (and all occurrences below replaced by 0),
+ * but that would force many users to use the `setkeycodes' utility, where
+ * they needed not before. It does not matter that there are duplicates, as
+ * long as no duplication occurs for any single keyboard.
+ */
+#define SC_LIM 89
+
+#define FOCUS_PF1 85 /* actual code! */
+#define FOCUS_PF2 89
+#define FOCUS_PF3 90
+#define FOCUS_PF4 91
+#define FOCUS_PF5 92
+#define FOCUS_PF6 93
+#define FOCUS_PF7 94
+#define FOCUS_PF8 95
+#define FOCUS_PF9 120
+#define FOCUS_PF10 121
+#define FOCUS_PF11 122
+#define FOCUS_PF12 123
+
+#define JAP_86 124
+/* tfj@olivia.ping.dk:
+ * The four keys are located over the numeric keypad, and are
+ * labelled A1-A4. It's an rc930 keyboard, from
+ * Regnecentralen/RC International, Now ICL.
+ * Scancodes: 59, 5a, 5b, 5c.
+ */
+#define RGN1 124
+#define RGN2 125
+#define RGN3 126
+#define RGN4 127
+
+static unsigned char high_keys[128 - SC_LIM] = {
+ RGN1, RGN2, RGN3, RGN4, 0, 0, 0, /* 0x59-0x5f */
+ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60-0x67 */
+ 0, 0, 0, 0, 0, FOCUS_PF11, 0, FOCUS_PF12, /* 0x68-0x6f */
+ 0, 0, 0, FOCUS_PF2, FOCUS_PF9, 0, 0, FOCUS_PF3, /* 0x70-0x77 */
+ FOCUS_PF4, FOCUS_PF5, FOCUS_PF6, FOCUS_PF7, /* 0x78-0x7b */
+ FOCUS_PF8, JAP_86, FOCUS_PF10, 0 /* 0x7c-0x7f */
+};
+
+/* BTC */
+#define E0_MACRO 112
+/* LK450 */
+#define E0_F13 113
+#define E0_F14 114
+#define E0_HELP 115
+#define E0_DO 116
+#define E0_F17 117
+#define E0_KPMINPLUS 118
+/*
+ * My OmniKey generates e0 4c for the "OMNI" key and the
+ * right alt key does nada. [kkoller@nyx10.cs.du.edu]
+ */
+#define E0_OK 124
+/*
+ * New microsoft keyboard is rumoured to have
+ * e0 5b (left window button), e0 5c (right window button),
+ * e0 5d (menu button). [or: LBANNER, RBANNER, RMENU]
+ * [or: Windows_L, Windows_R, TaskMan]
+ */
+#define E0_MSLW 125
+#define E0_MSRW 126
+#define E0_MSTM 127
+
+static unsigned char e0_keys[128] = {
+ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x00-0x07 */
+ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x08-0x0f */
+ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x10-0x17 */
+ 0, 0, 0, 0, E0_KPENTER, E0_RCTRL, 0, 0, /* 0x18-0x1f */
+ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x20-0x27 */
+ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x28-0x2f */
+ 0, 0, 0, 0, 0, E0_KPSLASH, 0, E0_PRSCR, /* 0x30-0x37 */
+ E0_RALT, 0, 0, 0, 0, E0_F13, E0_F14, E0_HELP, /* 0x38-0x3f */
+ E0_DO, E0_F17, 0, 0, 0, 0, E0_BREAK, E0_HOME, /* 0x40-0x47 */
+ E0_UP, E0_PGUP, 0, E0_LEFT, E0_OK, E0_RIGHT, E0_KPMINPLUS, E0_END, /* 0x48-0x4f */
+ E0_DOWN, E0_PGDN, E0_INS, E0_DEL, 0, 0, 0, 0, /* 0x50-0x57 */
+ 0, 0, 0, E0_MSLW, E0_MSRW, E0_MSTM, 0, 0, /* 0x58-0x5f */
+ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60-0x67 */
+ 0, 0, 0, 0, 0, 0, 0, E0_MACRO, /* 0x68-0x6f */
+ //0, 0, 0, 0, 0, 0, 0, 0, /* 0x70-0x77 */
+ 0, 0, 0, 0, 0, E0_BACKSLASH, 0, 0, /* 0x70-0x77 */
+ 0, 0, 0, E0_YEN, 0, 0, 0, 0 /* 0x78-0x7f */
+};
+
+static int gen_setkeycode(unsigned int scancode, unsigned int keycode)
+{
+ if (scancode < SC_LIM || scancode > 255 || keycode > 127)
+ return -EINVAL;
+ if (scancode < 128)
+ high_keys[scancode - SC_LIM] = keycode;
+ else
+ e0_keys[scancode - 128] = keycode;
+ return 0;
+}
+
+static int gen_getkeycode(unsigned int scancode)
+{
+ return
+ (scancode < SC_LIM || scancode > 255) ? -EINVAL :
+ (scancode <
+ 128) ? high_keys[scancode - SC_LIM] : e0_keys[scancode - 128];
+}
+
+static int
+gen_translate(unsigned char scancode, unsigned char *keycode, char raw_mode)
+{
+ static int prev_scancode = 0;
+
+ /* special prefix scancodes.. */
+ if (scancode == 0xe0 || scancode == 0xe1) {
+ prev_scancode = scancode;
+ return 0;
+ }
+
+ /* 0xFF is sent by a few keyboards, ignore it. 0x00 is error */
+ if (scancode == 0x00 || scancode == 0xff) {
+ prev_scancode = 0;
+ return 0;
+ }
+
+ scancode &= 0x7f;
+
+ if (prev_scancode) {
+ /*
+ * usually it will be 0xe0, but a Pause key generates
+ * e1 1d 45 e1 9d c5 when pressed, and nothing when released
+ */
+ if (prev_scancode != 0xe0) {
+ if (prev_scancode == 0xe1 && scancode == 0x1d) {
+ prev_scancode = 0x100;
+ return 0;
+ }
+ else if (prev_scancode == 0x100
+ && scancode == 0x45) {
+ *keycode = E1_PAUSE;
+ prev_scancode = 0;
+ } else {
+#ifdef KBD_REPORT_UNKN
+ if (!raw_mode)
+ printk(KERN_INFO
+ "keyboard: unknown e1 escape sequence\n");
+#endif
+ prev_scancode = 0;
+ return 0;
+ }
+ } else {
+ prev_scancode = 0;
+ /*
+ * The keyboard maintains its own internal caps lock and
+ * num lock statuses. In caps lock mode E0 AA precedes make
+ * code and E0 2A follows break code. In num lock mode,
+ * E0 2A precedes make code and E0 AA follows break code.
+ * We do our own book-keeping, so we will just ignore these.
+ */
+ /*
+ * For my keyboard there is no caps lock mode, but there are
+ * both Shift-L and Shift-R modes. The former mode generates
+ * E0 2A / E0 AA pairs, the latter E0 B6 / E0 36 pairs.
+ * So, we should also ignore the latter. - aeb@cwi.nl
+ */
+ if (scancode == 0x2a || scancode == 0x36)
+ return 0;
+
+ if (e0_keys[scancode])
+ *keycode = e0_keys[scancode];
+ else {
+#ifdef KBD_REPORT_UNKN
+ if (!raw_mode)
+ printk(KERN_INFO
+ "keyboard: unknown scancode e0 %02x\n",
+ scancode);
+#endif
+ return 0;
+ }
+ }
+ } else if (scancode >= SC_LIM) {
+ /* This happens with the FOCUS 9000 keyboard
+ Its keys PF1..PF12 are reported to generate
+ 55 73 77 78 79 7a 7b 7c 74 7e 6d 6f
+ Moreover, unless repeated, they do not generate
+ key-down events, so we have to zero up_flag below */
+ /* Also, Japanese 86/106 keyboards are reported to
+ generate 0x73 and 0x7d for \ - and \ | respectively. */
+ /* Also, some Brazilian keyboard is reported to produce
+ 0x73 and 0x7e for \ ? and KP-dot, respectively. */
+
+ *keycode = high_keys[scancode - SC_LIM];
+
+ if (!*keycode) {
+ if (!raw_mode) {
+#ifdef KBD_REPORT_UNKN
+ printk(KERN_INFO
+ "keyboard: unrecognized scancode (%02x)"
+ " - ignored\n", scancode);
+#endif
+ }
+ return 0;
+ }
+ } else
+ *keycode = scancode;
+ return 1;
+}
+
+static char gen_unexpected_up(unsigned char keycode)
+{
+ /* unexpected, but this can happen: maybe this was a key release for a
+ FOCUS 9000 PF key; if we want to see it, we have to clear up_flag */
+ if (keycode >= SC_LIM || keycode == 85)
+ return 0;
+ else
+ return 0200;
+}
+
+/*
+ * These are the default mappings
+ */
+int (*k_setkeycode)(unsigned int, unsigned int) = gen_setkeycode;
+int (*k_getkeycode)(unsigned int) = gen_getkeycode;
+int (*k_translate)(unsigned char, unsigned char *, char) = gen_translate;
+char (*k_unexpected_up)(unsigned char) = gen_unexpected_up;
void (*k_leds)(unsigned char);
+/* Simple translation table for the SysRq keys */
+
#ifdef CONFIG_MAGIC_SYSRQ
-int k_sysrq_key;
-unsigned char *k_sysrq_xlate;
+static unsigned char gen_sysrq_xlate[128] =
+ "\000\0331234567890-=\177\t" /* 0x00 - 0x0f */
+ "qwertyuiop[]\r\000as" /* 0x10 - 0x1f */
+ "dfghjkl;'`\000\\zxcv" /* 0x20 - 0x2f */
+ "bnm,./\000*\000 \000\201\202\203\204\205" /* 0x30 - 0x3f */
+ "\206\207\210\211\212\000\000789-456+1" /* 0x40 - 0x4f */
+ "230\177\000\000\213\214\000\000\000\000\000\000\000\000\000\000" /* 0x50 - 0x5f */
+ "\r\000/"; /* 0x60 - 0x6f */
+
+unsigned char *k_sysrq_xlate = gen_sysrq_xlate;
+int k_sysrq_key = 0x54;
#endif
diff -Nru a/arch/arm/mach-integrator/cpu.c b/arch/arm/mach-integrator/cpu.c
--- a/arch/arm/mach-integrator/cpu.c Thu Aug 1 14:17:40 2002
+++ b/arch/arm/mach-integrator/cpu.c Thu Aug 1 14:17:40 2002
@@ -1,9 +1,9 @@
/*
* linux/arch/arm/mach-integrator/cpu.c
*
- * Copyright (C) 2001 Deep Blue Solutions Ltd.
+ * Copyright (C) 2001-2002 Deep Blue Solutions Ltd.
*
- * $Id: cpu.c,v 1.5 2002/07/06 16:53:17 rmk Exp $
+ * $Id: cpu.c,v 1.6 2002/07/18 13:58:51 rmk Exp $
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@@ -15,6 +15,9 @@
#include
#include
#include
+#include
+#include
+#include
#include
#include
@@ -42,7 +45,7 @@
#ifdef CONFIG_CPU_FREQ
/*
- * Divisor indexes for in ascending divisor order
+ * Divisor indexes in ascending divisor order
*/
static unsigned char s2od[] = { 1, 3, 4, 7, 5, 2, 6, 0 };
@@ -70,7 +73,8 @@
* Validate the speed in khz. If it is outside our
* range, then return the lowest.
*/
-unsigned int integrator_validatespeed(unsigned int freq_khz)
+static unsigned int
+integrator_validatespeed(unsigned int cpu, unsigned int freq_khz)
{
struct vco vco;
@@ -87,11 +91,21 @@
return vco_to_freq(vco, 1);
}
-void integrator_setspeed(unsigned int freq_khz)
+static void integrator_setspeed(unsigned int cpu, unsigned int freq_khz)
{
struct vco vco = freq_to_vco(freq_khz, 1);
+ unsigned long cpus_allowed;
u_int cm_osc;
+ /*
+ * Save this threads cpus_allowed mask, and bind to the
+ * specified CPU. When this call returns, we should be
+ * running on the right CPU.
+ */
+ cpus_allowed = current->cpus_allowed;
+ set_cpus_allowed(current, 1 << cpu);
+ BUG_ON(cpu != smp_processor_id());
+
cm_osc = __raw_readl(CM_OSC);
cm_osc &= 0xfffff800;
cm_osc |= vco.vdw | vco.od << 8;
@@ -99,44 +113,72 @@
__raw_writel(0xa05f, CM_LOCK);
__raw_writel(cm_osc, CM_OSC);
__raw_writel(0, CM_LOCK);
+
+ /*
+ * Restore the CPUs allowed mask.
+ */
+ set_cpus_allowed(current, cpus_allowed);
}
+
+static struct cpufreq_driver integrator_driver = {
+ .validate = integrator_validatespeed,
+ .setspeed = integrator_setspeed,
+ .sync = 1,
+};
#endif
-static int __init cpu_init(void)
+static int __init integrator_cpu_init(void)
{
- u_int cm_osc, cm_stat, cpu_freq_khz, mem_freq_khz;
- struct vco vco;
+ struct cpufreq_freqs *freqs;
+ unsigned long cpus_allowed;
+ int cpu;
+
+ freqs = kmalloc(sizeof(struct cpufreq_freqs) * NR_CPUS,
+ GFP_KERNEL);
+ if (!freqs) {
+ printk(KERN_ERR "CPU: unable to allocate cpufreqs structure\n");
+ return -ENOMEM;
+ }
- cm_osc = __raw_readl(CM_OSC);
+ cpus_allowed = current->cpus_allowed;
+ for (cpu = 0; cpu < NR_CPUS; cpu++) {
+ u_int cm_osc, cm_stat, mem_freq_khz;
+ struct vco vco;
+
+ if (!cpu_online(cpu))
+ continue;
+
+ set_cpus_allowed(current, 1 << cpu);
+ BUG_ON(cpu != smp_processor_id());
+
+ cm_stat = __raw_readl(CM_STAT);
+ cm_osc = __raw_readl(CM_OSC);
+ vco.od = (cm_osc >> 20) & 7;
+ vco.vdw = (cm_osc >> 12) & 255;
+ mem_freq_khz = vco_to_freq(vco, 2);
+
+ printk(KERN_INFO "CPU%d: Module id: %d\n", cpu, cm_stat & 255);
+ printk(KERN_INFO "CPU%d: Memory clock = %d.%03d MHz\n",
+ cpu, mem_freq_khz / 1000, mem_freq_khz % 1000);
+
+ vco.od = (cm_osc >> 8) & 7;
+ vco.vdw = cm_osc & 255;
+
+ freqs[cpu].min = 12000;
+ freqs[cpu].max = 160000;
+ freqs[cpu].cur = vco_to_freq(vco, 1);
+ }
- vco.od = (cm_osc >> 20) & 7;
- vco.vdw = (cm_osc >> 12) & 255;
- mem_freq_khz = vco_to_freq(vco, 2);
-
- printk(KERN_INFO "Memory clock = %d.%03d MHz\n",
- mem_freq_khz / 1000, mem_freq_khz % 1000);
-
- vco.od = (cm_osc >> 8) & 7;
- vco.vdw = cm_osc & 255;
- cpu_freq_khz = vco_to_freq(vco, 1);
+ set_cpus_allowed(current, cpus_allowed);
#ifdef CONFIG_CPU_FREQ
- {
- struct cpufreq_driver cpufreq_driver;
-
- cpufreq_driver.freq.min = 12000;
- cpufreq_driver.freq.max = 160000;
- cpufreq_driver.freq.cur = cpu_freq_khz;
- cpufreq_driver.validate = &integrator_validatespeed;
- cpufreq_driver.setspeed = &integrator_setspeed;
- cpufreq_register(cpufreq_driver);
- }
+ integrator_driver.freq = freqs;
+ cpufreq_register(&integrator_driver);
+#else
+ kfree(freqs);
#endif
- cm_stat = __raw_readl(CM_STAT);
- printk("Module id: %d\n", cm_stat & 255);
-
return 0;
}
-__initcall(cpu_init);
+__initcall(integrator_cpu_init);
diff -Nru a/arch/arm/mach-sa1100/adsbitsy.c b/arch/arm/mach-sa1100/adsbitsy.c
--- a/arch/arm/mach-sa1100/adsbitsy.c Thu Aug 1 14:17:36 2002
+++ b/arch/arm/mach-sa1100/adsbitsy.c Thu Aug 1 14:17:36 2002
@@ -18,6 +18,7 @@
#include
#include
+#include
#include
#include
diff -Nru a/arch/arm/mach-sa1100/assabet.c b/arch/arm/mach-sa1100/assabet.c
--- a/arch/arm/mach-sa1100/assabet.c Thu Aug 1 14:17:36 2002
+++ b/arch/arm/mach-sa1100/assabet.c Thu Aug 1 14:17:36 2002
@@ -20,6 +20,7 @@
#include
#include
+#include
#include
#include
#include
diff -Nru a/arch/arm/mach-sa1100/badge4.c b/arch/arm/mach-sa1100/badge4.c
--- a/arch/arm/mach-sa1100/badge4.c Thu Aug 1 14:17:36 2002
+++ b/arch/arm/mach-sa1100/badge4.c Thu Aug 1 14:17:36 2002
@@ -22,6 +22,7 @@
#include
#include
+#include
#include
#include
diff -Nru a/arch/arm/mach-sa1100/cpu-sa1100.c b/arch/arm/mach-sa1100/cpu-sa1100.c
--- a/arch/arm/mach-sa1100/cpu-sa1100.c Thu Aug 1 14:17:36 2002
+++ b/arch/arm/mach-sa1100/cpu-sa1100.c Thu Aug 1 14:17:36 2002
@@ -91,7 +91,7 @@
#include
extern unsigned int sa11x0_freq_to_ppcr(unsigned int khz);
-extern unsigned int sa11x0_validatespeed(unsigned int khz);
+extern unsigned int sa11x0_validatespeed(unsigned int cpu, unsigned int khz);
extern unsigned int sa11x0_getspeed(void);
typedef struct {
@@ -220,29 +220,35 @@
};
-static void sa1100_setspeed(unsigned int khz)
+static void sa1100_setspeed(unsigned int cpu, unsigned int khz)
{
PPCR = sa11x0_freq_to_ppcr(khz);
}
+static struct cpufreq_freqs sa1100_freqs = {
+ .min = 59000,
+ .max = 287000,
+};
+
+static struct cpufreq_driver sa1100_driver = {
+ .freq = &sa1100_freqs,
+ .validate = sa11x0_validatespeed,
+ .setspeed = sa1100_setspeed,
+ .sync = 1,
+};
+
static int __init sa1100_dram_init(void)
{
int ret = -ENODEV;
if ((processor_id & CPU_SA1100_MASK) == CPU_SA1100_ID) {
- cpufreq_driver_t cpufreq_driver;
-
ret = cpufreq_register_notifier(&sa1100_dram_block);
if (ret)
return ret;
- cpufreq_driver.freq.min = 59000;
- cpufreq_driver.freq.max = 287000;
- cpufreq_driver.freq.cur = sa11x0_getspeed();
- cpufreq_driver.validate = &sa11x0_validatespeed;
- cpufreq_driver.setspeed = &sa1100_setspeed;
+ sa1100_freqs.cur = sa11x0_getspeed();
- ret = cpufreq_register(cpufreq_driver);<
+ ret = cpufreq_register(&sa1100_driver);
}
return ret;
diff -Nru a/arch/arm/mach-sa1100/cpu-sa1110.c b/arch/arm/mach-sa1100/cpu-sa1110.c
--- a/arch/arm/mach-sa1100/cpu-sa1110.c Thu Aug 1 14:17:36 2002
+++ b/arch/arm/mach-sa1100/cpu-sa1110.c Thu Aug 1 14:17:36 2002
@@ -24,13 +24,14 @@
#include
#include
+#include
#include
#include
#undef DEBUG
extern unsigned int sa11x0_freq_to_ppcr(unsigned int khz);
-extern unsigned int sa11x0_validatespeed(unsigned int khz);
+extern unsigned int sa11x0_validatespeed(unsigned int cpu, unsigned int khz);
extern unsigned int sa11x0_getspeed(void);
struct sdram_params {
@@ -213,7 +214,7 @@
* above, we can match for an exact frequency. If we don't find
* an exact match, we will to set the lowest frequency to be safe.
*/
-static void sa1110_setspeed(unsigned int khz)
+static void sa1110_setspeed(unsigned int cpu, unsigned int khz)
{
struct sdram_params *sdram = &sdram_params;
struct sdram_info sd;
@@ -284,6 +285,18 @@
sdram_update_refresh(khz, sdram);
}
+static struct cpufreq_freqs sa1110_freqs = {
+ .min = 59000,
+ .max = 287000,
+};
+
+static struct cpufreq_driver sa1110_driver = {
+ .freq = &sa1110_freqs,
+ .validate = sa11x0_validatespeed,
+ .setspeed = sa1110_setspeed,
+ .sync = 1,
+};
+
static int __init sa1110_clk_init(void)
{
struct sdram_params *sdram = NULL;
@@ -298,8 +311,6 @@
sdram = &samsung_km416s4030ct;
if (sdram) {
- struct cpufreq_driver cpufreq_driver;
-
printk(KERN_DEBUG "SDRAM: tck: %d trcd: %d trp: %d"
" twr: %d refresh: %d cas_latency: %d\n",
sdram->tck, sdram->trcd, sdram->trp,
@@ -307,15 +318,10 @@
memcpy(&sdram_params, sdram, sizeof(sdram_params));
- sa1110_setspeed(sa11x0_getspeed());
-
- cpufreq_driver.freq.min = 59000;
- cpufreq_driver.freq.max = 287000;
- cpufreq_driver.freq.cur = sa11x0_getspeed();
- cpufreq_driver.validate = &sa11x0_validatespeed;
- cpufreq_driver.setspeed = &sa1110_setspeed;
+ sa1110_freqs.cur = sa11x0_getspeed();
+ sa1110_setspeed(0, sa1110_freqs.cur);
- return cpufreq_register(cpufreq_driver);
+ return cpufreq_register(&sa1110_driver);
}
return 0;
diff -Nru a/arch/arm/mach-sa1100/freebird.c b/arch/arm/mach-sa1100/freebird.c
--- a/arch/arm/mach-sa1100/freebird.c Thu Aug 1 14:17:36 2002
+++ b/arch/arm/mach-sa1100/freebird.c Thu Aug 1 14:17:36 2002
@@ -9,6 +9,7 @@
#include
#include
+#include
#include
#include
diff -Nru a/arch/arm/mach-sa1100/generic.c b/arch/arm/mach-sa1100/generic.c
--- a/arch/arm/mach-sa1100/generic.c Thu Aug 1 14:17:39 2002
+++ b/arch/arm/mach-sa1100/generic.c Thu Aug 1 14:17:39 2002
@@ -71,7 +71,7 @@
* Validate the speed in khz. If we can't generate the precise
* frequency requested, round it down (to be on the safe side).
*/
-unsigned int sa11x0_validatespeed(unsigned int khz)
+unsigned int sa11x0_validatespeed(unsigned int cpu, unsigned int khz)
{
return cclk_frequency_100khz[sa11x0_freq_to_ppcr(khz)] * 100;
}
diff -Nru a/arch/arm/mach-sa1100/graphicsmaster.c b/arch/arm/mach-sa1100/graphicsmaster.c
--- a/arch/arm/mach-sa1100/graphicsmaster.c Thu Aug 1 14:17:40 2002
+++ b/arch/arm/mach-sa1100/graphicsmaster.c Thu Aug 1 14:17:40 2002
@@ -15,6 +15,7 @@
#include
#include
+#include
#include
#include
diff -Nru a/arch/arm/mach-sa1100/h3600.c b/arch/arm/mach-sa1100/h3600.c
--- a/arch/arm/mach-sa1100/h3600.c Thu Aug 1 14:17:37 2002
+++ b/arch/arm/mach-sa1100/h3600.c Thu Aug 1 14:17:37 2002
@@ -27,6 +27,7 @@
#include
#include
+#include
#include
#include
diff -Nru a/arch/arm/mach-sa1100/huw_webpanel.c b/arch/arm/mach-sa1100/huw_webpanel.c
--- a/arch/arm/mach-sa1100/huw_webpanel.c Thu Aug 1 14:17:40 2002
+++ b/arch/arm/mach-sa1100/huw_webpanel.c Thu Aug 1 14:17:40 2002
@@ -8,6 +8,7 @@
#include
#include
+#include
#include
#include
diff -Nru a/arch/arm/mach-sa1100/neponset.c b/arch/arm/mach-sa1100/neponset.c
--- a/arch/arm/mach-sa1100/neponset.c Thu Aug 1 14:17:40 2002
+++ b/arch/arm/mach-sa1100/neponset.c Thu Aug 1 14:17:40 2002
@@ -13,6 +13,7 @@
#include
#include
+#include
#include
#include
#include
diff -Nru a/arch/arm/mach-sa1100/omnimeter.c b/arch/arm/mach-sa1100/omnimeter.c
--- a/arch/arm/mach-sa1100/omnimeter.c Thu Aug 1 14:17:36 2002
+++ b/arch/arm/mach-sa1100/omnimeter.c Thu Aug 1 14:17:36 2002
@@ -7,6 +7,7 @@
#include
#include
+#include
#include
#include
diff -Nru a/arch/arm/mach-sa1100/pfs168.c b/arch/arm/mach-sa1100/pfs168.c
--- a/arch/arm/mach-sa1100/pfs168.c Thu Aug 1 14:17:36 2002
+++ b/arch/arm/mach-sa1100/pfs168.c Thu Aug 1 14:17:36 2002
@@ -9,6 +9,7 @@
#include
#include
+#include
#include
#include
diff -Nru a/arch/arm/mach-sa1100/sa1111.c b/arch/arm/mach-sa1100/sa1111.c
--- a/arch/arm/mach-sa1100/sa1111.c Thu Aug 1 14:17:40 2002
+++ b/arch/arm/mach-sa1100/sa1111.c Thu Aug 1 14:17:40 2002
@@ -27,6 +27,7 @@
#include
#include
+#include
#include
#include
#include
diff -Nru a/arch/arm/mach-sa1100/system3.c b/arch/arm/mach-sa1100/system3.c
--- a/arch/arm/mach-sa1100/system3.c Thu Aug 1 14:17:41 2002
+++ b/arch/arm/mach-sa1100/system3.c Thu Aug 1 14:17:41 2002
@@ -44,9 +44,8 @@
#include
#include
+#include
#include
-#include
-#include
#include
#include
diff -Nru a/arch/arm/mach-sa1100/yopy.c b/arch/arm/mach-sa1100/yopy.c
--- a/arch/arm/mach-sa1100/yopy.c Thu Aug 1 14:17:36 2002
+++ b/arch/arm/mach-sa1100/yopy.c Thu Aug 1 14:17:36 2002
@@ -7,6 +7,7 @@
#include
#include
+#include
#include
#include
diff -Nru a/arch/arm/mm/alignment.c b/arch/arm/mm/alignment.c
--- a/arch/arm/mm/alignment.c Thu Aug 1 14:17:36 2002
+++ b/arch/arm/mm/alignment.c Thu Aug 1 14:17:36 2002
@@ -399,13 +399,13 @@
eaddr += 4;
/*
- * For alignment faults on the ARM922T the MMU makes
+ * For alignment faults on the ARM922T/ARM920T the MMU makes
* the FSR (and hence addr) equal to the updated base address
* of the multiple access rather than the restored value.
- * Switch this messsage off if we've got a ARM922, otherwise
+ * Switch this messsage off if we've got a ARM92[02], otherwise
* [ls]dm alignment faults are noisy!
*/
-#if !(defined CONFIG_CPU_ARM922T)
+#if !(defined CONFIG_CPU_ARM922T) && !(defined CONFIG_CPU_ARM920T)
/*
* This is a "hint" - we already have eaddr worked out by the
* processor for us.
diff -Nru a/arch/arm/mm/init.c b/arch/arm/mm/init.c
--- a/arch/arm/mm/init.c Thu Aug 1 14:17:36 2002
+++ b/arch/arm/mm/init.c Thu Aug 1 14:17:36 2002
@@ -18,7 +18,6 @@
#include
#include
#include
-#include
#include
#include
#include
diff -Nru a/arch/arm/mm/mm-armv.c b/arch/arm/mm/mm-armv.c
--- a/arch/arm/mm/mm-armv.c Thu Aug 1 14:17:41 2002
+++ b/arch/arm/mm/mm-armv.c Thu Aug 1 14:17:41 2002
@@ -17,6 +17,7 @@
#include
#include
#include
+#include
#include
#include
@@ -149,6 +150,7 @@
pte = pmd_page(*pmd);
pmd_clear(pmd);
+ pgtable_remove_rmap(pte);
pte_free(pte);
pmd_free(pmd);
free:
diff -Nru a/arch/arm/tools/mach-types b/arch/arm/tools/mach-types
--- a/arch/arm/tools/mach-types Thu Aug 1 14:17:40 2002
+++ b/arch/arm/tools/mach-types Thu Aug 1 14:17:40 2002
@@ -6,7 +6,7 @@
# To add an entry into this database, please see Documentation/arm/README,
# or contact rmk@arm.linux.org.uk
#
-# Last update: Fri Jul 5 21:32:20 2002
+# Last update: Sat Jul 27 09:56:53 2002
#
# machine_is_xxx CONFIG_xxxx MACH_TYPE_xxx number
#
@@ -175,7 +175,7 @@
iam SA1100_IAM IAM 164
tt530 SA1100_TT530 TT530 165
sam2400 ARCH_SAM2400 SAM2400 166
-jornada56x ARCH_JORNADA56X JORNADA56X 167
+jornada56x SA1100_JORNADA56X JORNADA56X 167
active SA1100_ACTIVE ACTIVE 168
iq80321 ARCH_IQ80321 IQ80321 169
wid SA1100_WID WID 170
@@ -207,3 +207,10 @@
bitbox SA1100_BITBOX BITBOX 196
g200 SA1100_G200 G200 197
gill SA1100_GILL GILL 198
+pxa_mercury ARCH_PXA_MERCURY PXA_MERCURY 199
+ceiva ARCH_CEIVA CEIVA 200
+fret SA1100_FRET FRET 201
+emailphone SA1100_EMAILPHONE EMAILPHONE 202
+h3900 ARCH_H3900 H3900 203
+pxa1 ARCH_PXA1 PXA1 204
+koan369 SA1100_KOAN369 KOAN369 205
diff -Nru a/arch/i386/kernel/Makefile b/arch/i386/kernel/Makefile
--- a/arch/i386/kernel/Makefile Thu Aug 1 14:17:36 2002
+++ b/arch/i386/kernel/Makefile Thu Aug 1 14:17:36 2002
@@ -6,7 +6,7 @@
O_TARGET := kernel.o
-export-objs := mca.o mtrr.o msr.o cpuid.o microcode.o i386_ksyms.o time.o
+export-objs := mca.o mtrr.o i386_ksyms.o time.o
obj-y := process.o semaphore.o signal.o entry.o traps.o irq.o vm86.o \
ptrace.o i8259.o ioport.o ldt.o setup.o time.o sys_i386.o \
diff -Nru a/arch/i386/kernel/apic.c b/arch/i386/kernel/apic.c
--- a/arch/i386/kernel/apic.c Thu Aug 1 14:17:41 2002
+++ b/arch/i386/kernel/apic.c Thu Aug 1 14:17:41 2002
@@ -1140,7 +1140,7 @@
6: Received illegal vector
7: Illegal register address
*/
- printk (KERN_ERR "APIC error on CPU%d: %02lx(%02lx)\n",
+ printk (KERN_INFO "APIC error on CPU%d: %02lx(%02lx)\n",
smp_processor_id(), v , v1);
irq_exit();
}
diff -Nru a/arch/i386/kernel/apm.c b/arch/i386/kernel/apm.c
--- a/arch/i386/kernel/apm.c Thu Aug 1 14:17:36 2002
+++ b/arch/i386/kernel/apm.c Thu Aug 1 14:17:36 2002
@@ -1589,7 +1589,7 @@
p = buf;
- if ((num_possible_cpus() == 1) &&
+ if ((num_online_cpus() == 1) &&
!(error = apm_get_power_status(&bx, &cx, &dx))) {
ac_line_status = (bx >> 8) & 0xff;
battery_status = bx & 0xff;
@@ -1720,7 +1720,7 @@
}
}
- if (debug && (num_possible_cpus() == 1)) {
+ if (debug && (num_online_cpus() == 1)) {
error = apm_get_power_status(&bx, &cx, &dx);
if (error)
printk(KERN_INFO "apm: power status not available\n");
@@ -1764,7 +1764,7 @@
pm_power_off = apm_power_off;
register_sysrq_key('o', &sysrq_poweroff_op);
- if (num_possible_cpus() == 1) {
+ if (num_online_cpus() == 1) {
#if defined(CONFIG_APM_DISPLAY_BLANK) && defined(CONFIG_VT)
console_blank_hook = apm_console_blank;
#endif
@@ -1853,6 +1853,7 @@
static int __init apm_init(void)
{
struct proc_dir_entry *apm_proc;
+ int i;
if (apm_info.bios.version == 0) {
printk(KERN_INFO "apm: BIOS not found.\n");
@@ -1907,7 +1908,7 @@
printk(KERN_NOTICE "apm: disabled on user request.\n");
return -ENODEV;
}
- if ((num_possible_cpus() > 1) && !power_off) {
+ if ((num_online_cpus() > 1) && !power_off) {
printk(KERN_NOTICE "apm: disabled - APM is not SMP safe.\n");
return -ENODEV;
}
@@ -1926,37 +1927,39 @@
* NOTE: on SMP we call into the APM BIOS only on CPU#0, so it's
* enough to modify CPU#0's GDT.
*/
- set_base(cpu_gdt_table[0][APM_40 >> 3],
- __va((unsigned long)0x40 << 4));
- _set_limit((char *)&cpu_gdt_table[0][APM_40 >> 3], 4095 - (0x40 << 4));
-
- apm_bios_entry.offset = apm_info.bios.offset;
- apm_bios_entry.segment = APM_CS;
- set_base(cpu_gdt_table[0][APM_CS >> 3],
- __va((unsigned long)apm_info.bios.cseg << 4));
- set_base(cpu_gdt_table[0][APM_CS_16 >> 3],
- __va((unsigned long)apm_info.bios.cseg_16 << 4));
- set_base(cpu_gdt_table[0][APM_DS >> 3],
- __va((unsigned long)apm_info.bios.dseg << 4));
+ for (i = 0; i < NR_CPUS; i++) {
+ set_base(cpu_gdt_table[i][APM_40 >> 3],
+ __va((unsigned long)0x40 << 4));
+ _set_limit((char *)&cpu_gdt_table[i][APM_40 >> 3], 4095 - (0x40 << 4));
+
+ apm_bios_entry.offset = apm_info.bios.offset;
+ apm_bios_entry.segment = APM_CS;
+ set_base(cpu_gdt_table[i][APM_CS >> 3],
+ __va((unsigned long)apm_info.bios.cseg << 4));
+ set_base(cpu_gdt_table[i][APM_CS_16 >> 3],
+ __va((unsigned long)apm_info.bios.cseg_16 << 4));
+ set_base(cpu_gdt_table[i][APM_DS >> 3],
+ __va((unsigned long)apm_info.bios.dseg << 4));
#ifndef APM_RELAX_SEGMENTS
- if (apm_info.bios.version == 0x100) {
+ if (apm_info.bios.version == 0x100) {
#endif
- /* For ASUS motherboard, Award BIOS rev 110 (and others?) */
- _set_limit((char *)&cpu_gdt_table[0][APM_CS >> 3], 64 * 1024 - 1);
- /* For some unknown machine. */
- _set_limit((char *)&cpu_gdt_table[0][APM_CS_16 >> 3], 64 * 1024 - 1);
- /* For the DEC Hinote Ultra CT475 (and others?) */
- _set_limit((char *)&cpu_gdt_table[0][APM_DS >> 3], 64 * 1024 - 1);
+ /* For ASUS motherboard, Award BIOS rev 110 (and others?) */
+ _set_limit((char *)&cpu_gdt_table[i][APM_CS >> 3], 64 * 1024 - 1);
+ /* For some unknown machine. */
+ _set_limit((char *)&cpu_gdt_table[i][APM_CS_16 >> 3], 64 * 1024 - 1);
+ /* For the DEC Hinote Ultra CT475 (and others?) */
+ _set_limit((char *)&cpu_gdt_table[i][APM_DS >> 3], 64 * 1024 - 1);
#ifndef APM_RELAX_SEGMENTS
- } else {
- _set_limit((char *)&cpu_gdt_table[0][APM_CS >> 3],
- (apm_info.bios.cseg_len - 1) & 0xffff);
- _set_limit((char *)&cpu_gdt_table[0][APM_CS_16 >> 3],
- (apm_info.bios.cseg_16_len - 1) & 0xffff);
- _set_limit((char *)&cpu_gdt_table[0][APM_DS >> 3],
- (apm_info.bios.dseg_len - 1) & 0xffff);
- }
+ } else {
+ _set_limit((char *)&cpu_gdt_table[i][APM_CS >> 3],
+ (apm_info.bios.cseg_len - 1) & 0xffff);
+ _set_limit((char *)&cpu_gdt_table[i][APM_CS_16 >> 3],
+ (apm_info.bios.cseg_16_len - 1) & 0xffff);
+ _set_limit((char *)&cpu_gdt_table[i][APM_DS >> 3],
+ (apm_info.bios.dseg_len - 1) & 0xffff);
+ }
#endif
+ }
apm_proc = create_proc_info_entry("apm", 0, NULL, apm_get_info);
if (apm_proc)
@@ -1964,7 +1967,7 @@
kernel_thread(apm, NULL, CLONE_FS | CLONE_FILES | CLONE_SIGHAND | SIGCHLD);
- if (num_possible_cpus() > 1) {
+ if (num_online_cpus() > 1) {
printk(KERN_NOTICE
"apm: disabled - APM is not SMP safe (power off active).\n");
return 0;
diff -Nru a/arch/i386/kernel/entry.S b/arch/i386/kernel/entry.S
--- a/arch/i386/kernel/entry.S Thu Aug 1 14:17:39 2002
+++ b/arch/i386/kernel/entry.S Thu Aug 1 14:17:39 2002
@@ -689,8 +689,8 @@
.long sys_rt_sigtimedwait
.long sys_rt_sigqueueinfo
.long sys_rt_sigsuspend
- .long sys_pread /* 180 */
- .long sys_pwrite
+ .long sys_pread64 /* 180 */
+ .long sys_pwrite64
.long sys_chown16
.long sys_getcwd
.long sys_capget
diff -Nru a/arch/i386/kernel/i386_ksyms.c b/arch/i386/kernel/i386_ksyms.c
--- a/arch/i386/kernel/i386_ksyms.c Thu Aug 1 14:17:40 2002
+++ b/arch/i386/kernel/i386_ksyms.c Thu Aug 1 14:17:40 2002
@@ -132,6 +132,7 @@
EXPORT_SYMBOL_NOVERS(__read_lock_failed);
/* Global SMP stuff */
+EXPORT_SYMBOL(synchronize_irq);
EXPORT_SYMBOL(smp_call_function);
/* TLB flushing */
diff -Nru a/arch/i386/kernel/i8259.c b/arch/i386/kernel/i8259.c
--- a/arch/i386/kernel/i8259.c Thu Aug 1 14:17:41 2002
+++ b/arch/i386/kernel/i8259.c Thu Aug 1 14:17:41 2002
@@ -38,7 +38,8 @@
static void end_8259A_irq (unsigned int irq)
{
- if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
+ if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)) &&
+ irq_desc[irq].action)
enable_8259A_irq(irq);
}
diff -Nru a/arch/i386/kernel/io_apic.c b/arch/i386/kernel/io_apic.c
--- a/arch/i386/kernel/io_apic.c Thu Aug 1 14:17:40 2002
+++ b/arch/i386/kernel/io_apic.c Thu Aug 1 14:17:40 2002
@@ -791,7 +791,7 @@
entry.vector = vector;
/*
- * The timer IRQ doesnt have to know that behind the
+ * The timer IRQ doesn't have to know that behind the
* scene we have a 8259A-master in AEOI mode ...
*/
irq_desc[0].handler = &ioapic_edge_irq_type;
@@ -1654,7 +1654,7 @@
printk(" failed.\n");
if (nmi_watchdog) {
- printk(KERN_WARNING "timer doesnt work through the IO-APIC - disabling NMI Watchdog!\n");
+ printk(KERN_WARNING "timer doesn't work through the IO-APIC - disabling NMI Watchdog!\n");
nmi_watchdog = 0;
}
diff -Nru a/arch/i386/kernel/irq.c b/arch/i386/kernel/irq.c
--- a/arch/i386/kernel/irq.c Thu Aug 1 14:17:36 2002
+++ b/arch/i386/kernel/irq.c Thu Aug 1 14:17:36 2002
@@ -187,10 +187,6 @@
#if CONFIG_SMP
inline void synchronize_irq(unsigned int irq)
{
- /* is there anything to synchronize with? */
- if (!irq_desc[irq].action)
- return;
-
while (irq_desc[irq].status & IRQ_INPROGRESS)
cpu_relax();
}
@@ -350,7 +346,7 @@
* use the action we have.
*/
action = NULL;
- if (!(status & (IRQ_DISABLED | IRQ_INPROGRESS))) {
+ if (likely(!(status & (IRQ_DISABLED | IRQ_INPROGRESS)))) {
action = desc->action;
status &= ~IRQ_PENDING; /* we commit to handling */
status |= IRQ_INPROGRESS; /* we are handling it */
@@ -363,7 +359,7 @@
a different instance of this same irq, the other processor
will take care of it.
*/
- if (!action)
+ if (unlikely(!action))
goto out;
/*
@@ -381,12 +377,12 @@
handle_IRQ_event(irq, ®s, action);
spin_lock(&desc->lock);
- if (!(desc->status & IRQ_PENDING))
+ if (likely(!(desc->status & IRQ_PENDING)))
break;
desc->status &= ~IRQ_PENDING;
}
- desc->status &= ~IRQ_INPROGRESS;
out:
+ desc->status &= ~IRQ_INPROGRESS;
/*
* The ->end() handler has to deal with interrupts which got
* disabled while the handler was running.
diff -Nru a/arch/i386/kernel/process.c b/arch/i386/kernel/process.c
--- a/arch/i386/kernel/process.c Thu Aug 1 14:17:36 2002
+++ b/arch/i386/kernel/process.c Thu Aug 1 14:17:36 2002
@@ -476,32 +476,42 @@
}
/*
+ * This gets run with %ebx containing the
+ * function to call, and %edx containing
+ * the "args".
+ */
+extern void kernel_thread_helper(void);
+__asm__(".align 4\n"
+ "kernel_thread_helper:\n\t"
+ "movl %edx,%eax\n\t"
+ "pushl %edx\n\t"
+ "call *%ebx\n\t"
+ "pushl %eax\n\t"
+ "call do_exit");
+
+/*
* Create a kernel thread
*/
int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
{
- long retval, d0;
+ struct task_struct *p;
+ struct pt_regs regs;
- __asm__ __volatile__(
- "movl %%esp,%%esi\n\t"
- "int $0x80\n\t" /* Linux/i386 system call */
- "cmpl %%esp,%%esi\n\t" /* child or parent? */
- "je 1f\n\t" /* parent - jump */
- /* Load the argument into eax, and push it. That way, it does
- * not matter whether the called function is compiled with
- * -mregparm or not. */
- "movl %4,%%eax\n\t"
- "pushl %%eax\n\t"
- "call *%5\n\t" /* call fn */
- "movl %3,%0\n\t" /* exit */
- "int $0x80\n"
- "1:\t"
- :"=&a" (retval), "=&S" (d0)
- :"0" (__NR_clone), "i" (__NR_exit),
- "r" (arg), "r" (fn),
- "b" (flags | CLONE_VM)
- : "memory");
- return retval;
+ memset(®s, 0, sizeof(regs));
+
+ regs.ebx = (unsigned long) fn;
+ regs.edx = (unsigned long) arg;
+
+ regs.xds = __KERNEL_DS;
+ regs.xes = __KERNEL_DS;
+ regs.orig_eax = -1;
+ regs.eip = (unsigned long) kernel_thread_helper;
+ regs.xcs = __KERNEL_CS;
+ regs.eflags = 0x286;
+
+ /* Ok, create the new process.. */
+ p = do_fork(flags | CLONE_VM, 0, ®s, 0);
+ return IS_ERR(p) ? PTR_ERR(p) : p->pid;
}
/*
@@ -675,6 +685,14 @@
tss->esp0 = next->esp0;
/*
+ * Load the per-thread Thread-Local Storage descriptor.
+ *
+ * NOTE: it's faster to do the two stores unconditionally
+ * than to branch away.
+ */
+ load_TLS_desc(next, cpu);
+
+ /*
* Save away %fs and %gs. No need to save %es and %ds, as
* those are always kernel segments while inside the kernel.
*/
@@ -690,14 +708,6 @@
}
/*
- * Load the per-thread Thread-Local Storage descriptor.
- *
- * NOTE: it's faster to do the two stores unconditionally
- * than to branch away.
- */
- load_TLS_desc(next, cpu);
-
- /*
* Now maybe reload the debug registers
*/
if (unlikely(next->debugreg[7])) {
@@ -831,34 +841,16 @@
/*
* Set the Thread-Local Storage area:
*/
-asmlinkage int sys_set_thread_area(unsigned int base, unsigned int limit, unsigned int flags)
+asmlinkage int sys_set_thread_area(unsigned long base, unsigned long flags)
{
struct thread_struct *t = ¤t->thread;
- int limit_in_pages = 0, writable = 0;
+ int writable = 0;
int cpu;
/* do not allow unused flags */
if (flags & ~TLS_FLAGS_MASK)
return -EINVAL;
- /* check limit */
- if (limit & 0xfff00000)
- return -EINVAL;
-
- /*
- * Clear the TLS?
- */
- if (flags & TLS_FLAG_CLEAR) {
- cpu = get_cpu();
- t->tls_base = t->tls_limit = t->tls_flags = 0;
- t->tls_desc.a = t->tls_desc.b = 0;
- load_TLS_desc(t, cpu);
- put_cpu();
- return 0;
- }
-
- if (flags & TLS_FLAG_LIMIT_IN_PAGES)
- limit_in_pages = 1;
if (flags & TLS_FLAG_WRITABLE)
writable = 1;
@@ -866,15 +858,12 @@
* We must not get preempted while modifying the TLS.
*/
cpu = get_cpu();
- t->tls_base = base;
- t->tls_limit = limit;
- t->tls_flags = flags;
- t->tls_desc.a = ((base & 0x0000ffff) << 16) | (limit & 0x0ffff);
+ t->tls_desc.a = ((base & 0x0000ffff) << 16) | 0xffff;
t->tls_desc.b = (base & 0xff000000) | ((base & 0x00ff0000) >> 16) |
- (limit & 0xf0000) | (writable << 9) | (1 << 15) |
- (1 << 22) | (limit_in_pages << 23) | 0x7000;
+ 0xf0000 | (writable << 9) | (1 << 15) |
+ (1 << 22) | (1 << 23) | 0x7000;
load_TLS_desc(t, cpu);
put_cpu();
diff -Nru a/arch/i386/mm/init.c b/arch/i386/mm/init.c
--- a/arch/i386/mm/init.c Thu Aug 1 14:17:37 2002
+++ b/arch/i386/mm/init.c Thu Aug 1 14:17:37 2002
@@ -54,7 +54,7 @@
#if CONFIG_X86_PAE
pmd_table = (pmd_t *) alloc_bootmem_low_pages(PAGE_SIZE);
- set_pgd(pgd, __pgd(__pa(md_table) | _PAGE_PRESENT));
+ set_pgd(pgd, __pgd(__pa(pmd_table) | _PAGE_PRESENT));
if (pmd_table != pmd_offset(pgd, 0))
BUG();
#else
diff -Nru a/arch/ia64/config.in b/arch/ia64/config.in
--- a/arch/ia64/config.in Thu Aug 1 14:17:41 2002
+++ b/arch/ia64/config.in Thu Aug 1 14:17:41 2002
@@ -71,15 +71,15 @@
if [ "$CONFIG_IA64_SGI_SN1" = "y" -o "$CONFIG_IA64_SGI_SN2" = "y" ]; then
define_bool CONFIG_IA64_SGI_SN y
- bool ' Enable extra debugging code' CONFIG_IA64_SGI_SN_DEBUG n
+ bool ' Enable extra debugging code' CONFIG_IA64_SGI_SN_DEBUG
bool ' Enable SGI Medusa Simulator Support' CONFIG_IA64_SGI_SN_SIM
bool ' Enable autotest (llsc). Option to run cache test instead of booting' \
- CONFIG_IA64_SGI_AUTOTEST n
+ CONFIG_IA64_SGI_AUTOTEST
define_bool CONFIG_DEVFS_FS y
if [ "$CONFIG_DEVFS_FS" = "y" ]; then
- bool ' Enable DEVFS Debug Code' CONFIG_DEVFS_DEBUG n
+ bool ' Enable DEVFS Debug Code' CONFIG_DEVFS_DEBUG
fi
- bool ' Enable protocol mode for the L1 console' CONFIG_SERIAL_SGI_L1_PROTOCOL y
+ bool ' Enable protocol mode for the L1 console' CONFIG_SERIAL_SGI_L1_PROTOCOL
define_bool CONFIG_DISCONTIGMEM y
define_bool CONFIG_IA64_MCA y
define_bool CONFIG_NUMA y
diff -Nru a/arch/ia64/ia32/sys_ia32.c b/arch/ia64/ia32/sys_ia32.c
--- a/arch/ia64/ia32/sys_ia32.c Thu Aug 1 14:17:41 2002
+++ b/arch/ia64/ia32/sys_ia32.c Thu Aug 1 14:17:41 2002
@@ -3648,15 +3648,15 @@
asmlinkage long
sys32_pread (unsigned int fd, void *buf, unsigned int count, u32 pos_lo, u32 pos_hi)
{
- extern asmlinkage long sys_pread (unsigned int, char *, size_t, loff_t);
- return sys_pread(fd, buf, count, ((unsigned long) pos_hi << 32) | pos_lo);
+ extern asmlinkage long sys_pread64 (unsigned int, char *, size_t, loff_t);
+ return sys_pread64(fd, buf, count, ((unsigned long) pos_hi << 32) | pos_lo);
}
asmlinkage long
sys32_pwrite (unsigned int fd, void *buf, unsigned int count, u32 pos_lo, u32 pos_hi)
{
- extern asmlinkage long sys_pwrite (unsigned int, const char *, size_t, loff_t);
- return sys_pwrite(fd, buf, count, ((unsigned long) pos_hi << 32) | pos_lo);
+ extern asmlinkage long sys_pwrite64 (unsigned int, const char *, size_t, loff_t);
+ return sys_pwrite64(fd, buf, count, ((unsigned long) pos_hi << 32) | pos_lo);
}
asmlinkage long
diff -Nru a/arch/ia64/kernel/entry.S b/arch/ia64/kernel/entry.S
--- a/arch/ia64/kernel/entry.S Thu Aug 1 14:17:39 2002
+++ b/arch/ia64/kernel/entry.S Thu Aug 1 14:17:39 2002
@@ -1134,8 +1134,8 @@
data8 sys_flock // 1145
data8 sys_readv
data8 sys_writev
- data8 sys_pread
- data8 sys_pwrite
+ data8 sys_pread64
+ data8 sys_pwrite64
data8 sys_sysctl // 1150
data8 sys_mmap
data8 sys_munmap
diff -Nru a/arch/ia64/lib/Makefile b/arch/ia64/lib/Makefile
--- a/arch/ia64/lib/Makefile Thu Aug 1 14:17:41 2002
+++ b/arch/ia64/lib/Makefile Thu Aug 1 14:17:41 2002
@@ -4,7 +4,7 @@
L_TARGET = lib.a
-export-objs := io.o swiotlb.o
+export-objs := swiotlb.o
obj-y := __divsi3.o __udivsi3.o __modsi3.o __umodsi3.o \
__divdi3.o __udivdi3.o __moddi3.o __umoddi3.o \
diff -Nru a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
--- a/arch/ia64/mm/init.c Thu Aug 1 14:17:40 2002
+++ b/arch/ia64/mm/init.c Thu Aug 1 14:17:40 2002
@@ -167,10 +167,10 @@
#ifdef CONFIG_DISCONTIGMEM
{
- pg_data_t *pgdat = pgdat_list;
+ pg_data_t *pgdat;
printk("Free swap: %6dkB\n", nr_swap_pages<<(PAGE_SHIFT-10));
- do {
+ for_each_pgdat(pgdat) {
printk("Node ID: %d\n", pgdat->node_id);
for(i = 0; i < pgdat->node_size; i++) {
if (PageReserved(pgdat->node_mem_map+i))
@@ -184,8 +184,7 @@
printk("\t%d reserved pages\n", reserved);
printk("\t%d pages shared\n", shared);
printk("\t%d pages swap cached\n", cached);
- pgdat = pgdat->node_next;
- } while (pgdat);
+ }
printk("Total of %ld pages in page table cache\n", pgtable_cache_size);
printk("%d free buffer pages\n", nr_free_buffer_pages());
}
diff -Nru a/arch/ia64/sn/io/Makefile b/arch/ia64/sn/io/Makefile
--- a/arch/ia64/sn/io/Makefile Thu Aug 1 14:17:39 2002
+++ b/arch/ia64/sn/io/Makefile Thu Aug 1 14:17:39 2002
@@ -18,7 +18,7 @@
O_TARGET := sgiio.o
ifeq ($(CONFIG_MODULES),y)
-export-objs = pciio.o hcl.o pci_dma.o
+export-objs = pciio.o hcl.o
endif
obj-y := stubs.o sgi_if.o pciio.o xtalk.o xbow.o xswitch.o klgraph_hack.o \
diff -Nru a/arch/ia64/sn/io/hcl.c b/arch/ia64/sn/io/hcl.c
--- a/arch/ia64/sn/io/hcl.c Thu Aug 1 14:17:39 2002
+++ b/arch/ia64/sn/io/hcl.c Thu Aug 1 14:17:39 2002
@@ -673,8 +673,9 @@
* Call devfs to get the devfs entry.
*/
namelen = (int) strlen(name);
- target_handle = devfs_find_handle (from, name, 0, 0,
+ target_handle = devfs_get_handle(from, name, 0, 0,
0, 1); /* Yes traverse symbolic links */
+ devfs_put(target_handle); /* Assume we're the owner */
if (target_handle == NULL)
return(-1);
else
@@ -952,12 +953,13 @@
devfs_handle_t *vertex_handle_ptr,
char **remainder)
{
- *vertex_handle_ptr = devfs_find_handle(start_vertex_handle, /* start dir */
+ *vertex_handle_ptr = devfs_get_handle(start_vertex_handle, /* start dir */
lookup_path, /* path */
0, /* major */
0, /* minor */
0, /* char | block */
1); /* traverse symlinks */
+ devfs_put(*vertex_handle_ptr); /* Assume we're the owner */
if (*vertex_handle_ptr == NULL)
return(-1);
else
@@ -965,22 +967,23 @@
}
/*
- * hwgraph_traverse - Find and return the devfs handle starting from de.
+ * hwgraph_traverse - Find and return the devfs handle starting from dir.
*
*/
graph_error_t
-hwgraph_traverse(devfs_handle_t de, char *path, devfs_handle_t *found)
+hwgraph_traverse(devfs_handle_t dir, char *path, devfs_handle_t *found)
{
/*
* get the directory entry (path should end in a directory)
*/
- *found = devfs_find_handle(de, /* start dir */
+ *found = devfs_get_handle(dir, /* start dir */
path, /* path */
0, /* major */
0, /* minor */
0, /* char | block */
1); /* traverse symlinks */
+ devfs_put(*found); /* Assume we're the owner */
if (*found == NULL)
return(GRAPH_NOT_FOUND);
else
@@ -994,12 +997,16 @@
devfs_handle_t
hwgraph_path_to_vertex(char *path)
{
- return(devfs_find_handle(NULL, /* start dir */
+ devfs_handle_t de;
+
+ de = devfs_get_handle(NULL, /* start dir */
path, /* path */
0, /* major */
0, /* minor */
0, /* char | block */
- 1)); /* traverse symlinks */
+ 1);
+ devfs_put(de); /* Assume we're the owner */
+ return(de);
}
/*
@@ -1017,32 +1024,40 @@
/*
* hwgraph_block_device_get - return the handle of the block device file.
- * The assumption here is that de is a directory.
+ * The assumption here is that dir is a directory.
*/
devfs_handle_t
-hwgraph_block_device_get(devfs_handle_t de)
+hwgraph_block_device_get(devfs_handle_t dir)
{
- return(devfs_find_handle(de, /* start dir */
+ devfs_handle_t de;
+
+ de = devfs_get_handle(dir, /* start dir */
"block", /* path */
0, /* major */
0, /* minor */
DEVFS_SPECIAL_BLK, /* char | block */
- 1)); /* traverse symlinks */
+ 1); /* traverse symlinks */
+ devfs_put(de); /* Assume we're the owner */
+ return(de);
}
/*
* hwgraph_char_device_get - return the handle of the char device file.
- * The assumption here is that de is a directory.
+ * The assumption here is that dir is a directory.
*/
devfs_handle_t
-hwgraph_char_device_get(devfs_handle_t de)
+hwgraph_char_device_get(devfs_handle_t dir)
{
- return(devfs_find_handle(de, /* start dir */
+ devfs_handle_t de;
+
+ de = devfs_get_handle(dir, /* start dir */
"char", /* path */
0, /* major */
0, /* minor */
DEVFS_SPECIAL_CHR, /* char | block */
- 1)); /* traverse symlinks */
+ 1); /* traverse symlinks */
+ devfs_put(de); /* Assume we're the owner */
+ return(de);
}
/*
diff -Nru a/arch/m68k/atari/joystick.c b/arch/m68k/atari/joystick.c
--- a/arch/m68k/atari/joystick.c Thu Aug 1 14:17:36 2002
+++ b/arch/m68k/atari/joystick.c Thu Aug 1 14:17:36 2002
@@ -134,7 +134,7 @@
init_waitqueue_head(&joystick[0].wait);
init_waitqueue_head(&joystick[1].wait);
- if (devfs_register_chrdev(MAJOR_NR, "Joystick", &atari_joystick_fops))
+ if (register_chrdev(MAJOR_NR, "Joystick", &atari_joystick_fops))
printk("unable to get major %d for joystick devices\n", MAJOR_NR);
devfs_register_series (NULL, "joysticks/digital%u", 2, DEVFS_FL_DEFAULT,
MAJOR_NR, 128, S_IFCHR | S_IRUSR | S_IWUSR,
diff -Nru a/arch/m68k/kernel/entry.S b/arch/m68k/kernel/entry.S
--- a/arch/m68k/kernel/entry.S Thu Aug 1 14:17:36 2002
+++ b/arch/m68k/kernel/entry.S Thu Aug 1 14:17:36 2002
@@ -608,8 +608,8 @@
.long sys_rt_sigtimedwait
.long sys_rt_sigqueueinfo
.long sys_rt_sigsuspend
- .long sys_pread /* 180 */
- .long sys_pwrite
+ .long sys_pread64 /* 180 */
+ .long sys_pwrite64
.long sys_lchown16;
.long sys_getcwd
.long sys_capget
diff -Nru a/arch/mips/baget/Makefile b/arch/mips/baget/Makefile
--- a/arch/mips/baget/Makefile Thu Aug 1 14:17:41 2002
+++ b/arch/mips/baget/Makefile Thu Aug 1 14:17:41 2002
@@ -5,7 +5,7 @@
O_TARGET := baget.a
-export-objs := vacserial.o vacrtc.o
+export-objs := vacserial.o
obj-y := baget.o print.o setup.o time.o irq.o bagetIRQ.o \
reset.o wbflush.o
obj-$(CONFIG_SERIAL) += vacserial.o
diff -Nru a/arch/mips/kernel/Makefile b/arch/mips/kernel/Makefile
--- a/arch/mips/kernel/Makefile Thu Aug 1 14:17:40 2002
+++ b/arch/mips/kernel/Makefile Thu Aug 1 14:17:40 2002
@@ -6,6 +6,7 @@
O_TARGET := kernel.o
EXTRA_TARGETS := head.o init_task.o
+export-objs := mips_ksyms.o
obj-y += branch.o process.o signal.o entry.o \
traps.o ptrace.o vm86.o ioport.o reset.o \
@@ -27,14 +28,12 @@
obj-$(CONFIG_SMP) += smp.o
# Old style irq support, going to die in 2.5.
-export-objs += old-irq.o
obj-$(CONFIG_NEW_IRQ) += irq.o
obj-$(CONFIG_ROTTEN_IRQ) += old-irq.o
obj-$(CONFIG_I8259) += i8259.o
# transition from old time.c to new time.c
# some boards uses old-time.c, some use time.c, and some use their own ones
-export-objs += old-time.o time.o
obj-$(CONFIG_OLD_TIME_C) += old-time.o
obj-$(CONFIG_NEW_TIME_C) += time.o
diff -Nru a/arch/mips/mm/init.c b/arch/mips/mm/init.c
--- a/arch/mips/mm/init.c Thu Aug 1 14:17:41 2002
+++ b/arch/mips/mm/init.c Thu Aug 1 14:17:41 2002
@@ -24,7 +24,6 @@
#include
#include
#include
-#include
#ifdef CONFIG_BLK_DEV_INITRD
#include
#endif
diff -Nru a/arch/mips64/kernel/scall_64.S b/arch/mips64/kernel/scall_64.S
--- a/arch/mips64/kernel/scall_64.S Thu Aug 1 14:17:36 2002
+++ b/arch/mips64/kernel/scall_64.S Thu Aug 1 14:17:36 2002
@@ -333,8 +333,8 @@
PTR sys_rt_sigtimedwait
PTR sys_rt_sigqueueinfo
PTR sys_rt_sigsuspend
- PTR sys_pread /* 5200 */
- PTR sys_pwrite
+ PTR sys_pread64 /* 5200 */
+ PTR sys_pwrite64
PTR sys_chown
PTR sys_getcwd
PTR sys_capget
diff -Nru a/arch/mips64/mm/init.c b/arch/mips64/mm/init.c
--- a/arch/mips64/mm/init.c Thu Aug 1 14:17:36 2002
+++ b/arch/mips64/mm/init.c Thu Aug 1 14:17:36 2002
@@ -21,7 +21,6 @@
#include
#include
#include
-#include
#ifdef CONFIG_BLK_DEV_INITRD
#include
#endif
diff -Nru a/arch/ppc/8260_io/Config.in b/arch/ppc/8260_io/Config.in
--- a/arch/ppc/8260_io/Config.in Thu Aug 1 14:17:36 2002
+++ b/arch/ppc/8260_io/Config.in Thu Aug 1 14:17:36 2002
@@ -26,7 +26,7 @@
choice 'Type of PHY' \
"LXT970 CONFIG_FCC_LXT970 \
LXT971 CONFIG_FCC_LXT971 \
- QS6612 CONFIG_FCC_QS6612" CONFIG_FCC_LXT971
+ QS6612 CONFIG_FCC_QS6612" LXT971
fi
fi
fi
diff -Nru a/arch/ppc/8xx_io/Makefile b/arch/ppc/8xx_io/Makefile
--- a/arch/ppc/8xx_io/Makefile Thu Aug 1 14:17:40 2002
+++ b/arch/ppc/8xx_io/Makefile Thu Aug 1 14:17:40 2002
@@ -11,6 +11,8 @@
O_TARGET := 8xx_io.o
+export-objs := fec.o
+
obj-y := commproc.o uart.o
obj-$(CONFIG_FEC_ENET) += fec.o
diff -Nru a/arch/ppc/boot/common/misc-common.c b/arch/ppc/boot/common/misc-common.c
--- a/arch/ppc/boot/common/misc-common.c Thu Aug 1 14:17:40 2002
+++ b/arch/ppc/boot/common/misc-common.c Thu Aug 1 14:17:40 2002
@@ -75,7 +75,7 @@
void _vprintk(void(*putc)(const char), const char *fmt0, va_list ap);
unsigned char *ISA_io = NULL;
-#if defined(CONFIG_SERIAL_CONSOLE)
+#if defined(CONFIG_SERIAL_CONSOLE) || defined(CONFIG_SERIAL_8250_CONSOLE)
extern unsigned long com_port;
extern int serial_tstc(unsigned long com_port);
@@ -96,7 +96,7 @@
int tstc(void)
{
-#if defined(CONFIG_SERIAL_CONSOLE)
+#if defined(CONFIG_SERIAL_CONSOLE) || defined(CONFIG_SERIAL_8250_CONSOLE)
if(keyb_present)
return (CRT_tstc() || serial_tstc(com_port));
else
@@ -109,10 +109,10 @@
int getc(void)
{
while (1) {
-#if defined(CONFIG_SERIAL_CONSOLE)
+#if defined(CONFIG_SERIAL_CONSOLE) || defined(CONFIG_SERIAL_8250_CONSOLE)
if (serial_tstc(com_port))
return (serial_getc(com_port));
-#endif /* CONFIG_SERIAL_CONSOLE */
+#endif /* serial console */
if (keyb_present)
if(CRT_tstc())
return (CRT_getc());
@@ -124,11 +124,11 @@
{
int x,y;
-#if defined(CONFIG_SERIAL_CONSOLE)
+#if defined(CONFIG_SERIAL_CONSOLE) || defined(CONFIG_SERIAL_8250_CONSOLE)
serial_putc(com_port, c);
if ( c == '\n' )
serial_putc(com_port, '\r');
-#endif /* CONFIG_SERIAL_CONSOLE */
+#endif /* serial console */
x = orig_x;
y = orig_y;
@@ -171,10 +171,10 @@
y = orig_y;
while ( ( c = *s++ ) != '\0' ) {
-#if defined(CONFIG_SERIAL_CONSOLE)
+#if defined(CONFIG_SERIAL_CONSOLE) || defined(CONFIG_SERIAL_8250_CONSOLE)
serial_putc(com_port, c);
if ( c == '\n' ) serial_putc(com_port, '\r');
-#endif /* CONFIG_SERIAL_CONSOLE */
+#endif /* serial console */
if ( c == '\n' ) {
x = 0;
diff -Nru a/arch/ppc/boot/prep/Makefile b/arch/ppc/boot/prep/Makefile
--- a/arch/ppc/boot/prep/Makefile Thu Aug 1 14:17:41 2002
+++ b/arch/ppc/boot/prep/Makefile Thu Aug 1 14:17:41 2002
@@ -27,7 +27,7 @@
OBJCOPY_ARGS = -O elf32-powerpc
LIBS = ../lib/zlib.a
-boot-$(CONFIG_SERIAL_CONSOLE) += ../common/ns16550.o
+boot-$($CONFIG_SERIAL_8250_CONSOLE) += ../common/ns16550.o
boot-$(CONFIG_VGA_CONSOLE) += vreset.o kbd.o
EXTRA_TARGETS := $(boot-y)
diff -Nru a/arch/ppc/boot/prep/misc.c b/arch/ppc/boot/prep/misc.c
--- a/arch/ppc/boot/prep/misc.c Thu Aug 1 14:17:36 2002
+++ b/arch/ppc/boot/prep/misc.c Thu Aug 1 14:17:36 2002
@@ -56,9 +56,9 @@
char *zimage_start;
int zimage_size;
-#if defined(CONFIG_SERIAL_CONSOLE)
+#if defined(CONFIG_SERIAL_8250_CONSOLE)
unsigned long com_port;
-#endif /* CONFIG_SERIAL_CONSOLE */
+#endif /* CONFIG_SERIAL_8250_CONSOLE */
#ifdef CONFIG_VGA_CONSOLE
char *vidmem = (char *)0xC00B8000;
int lines = 25, cols = 80;
@@ -135,9 +135,9 @@
unsigned int pci_viddid, pci_did, tulip_pci_base, tulip_base;
serial_fixups();
-#if defined(CONFIG_SERIAL_CONSOLE)
+#if defined(CONFIG_SERIAL_8250_CONSOLE)
com_port = serial_init(0, NULL);
-#endif /* CONFIG_SERIAL_CONSOLE */
+#endif /* CONFIG_SERIAL_8250_CONSOLE */
#if defined(CONFIG_VGA_CONSOLE)
vga_init((unsigned char *)0xC0000000);
#endif /* CONFIG_VGA_CONSOLE */
diff -Nru a/arch/ppc/boot/simple/Makefile b/arch/ppc/boot/simple/Makefile
--- a/arch/ppc/boot/simple/Makefile Thu Aug 1 14:17:36 2002
+++ b/arch/ppc/boot/simple/Makefile Thu Aug 1 14:17:36 2002
@@ -136,9 +136,9 @@
ifeq ($(CONFIG_SERIAL_CONSOLE),y)
boot-$(CONFIG_8xx) += m8xx_tty.o
boot-$(CONFIG_8260) += m8260_tty.o
-boot-$(CONFIG_GT64260_CONSOLE) += gt64260_tty.o
-boot-$(CONFIG_SERIAL) += ../common/ns16550.o
+boot-$(CONFIG_GT64260_CONSOLE) += gt64260_tty.o
endif
+boot-$(CONFIG_SERIAL_8250_CONSOLE) += ../common/ns16550.o
EXTRA_TARGETS := $(boot-y)
LIBS := ../lib/zlib.a
diff -Nru a/arch/ppc/boot/simple/misc-spruce.c b/arch/ppc/boot/simple/misc-spruce.c
--- a/arch/ppc/boot/simple/misc-spruce.c Thu Aug 1 14:17:40 2002
+++ b/arch/ppc/boot/simple/misc-spruce.c Thu Aug 1 14:17:40 2002
@@ -189,7 +189,7 @@
unsigned char header_type;
unsigned int bar0;
-#ifdef CONFIG_SERIAL_CONSOLE
+#ifdef CONFIG_SERIAL_8250_CONSOLE
/* Initialize the serial console port */
com_port = serial_init(0, NULL);
#endif
diff -Nru a/arch/ppc/config.in b/arch/ppc/config.in
--- a/arch/ppc/config.in Thu Aug 1 14:17:36 2002
+++ b/arch/ppc/config.in Thu Aug 1 14:17:36 2002
@@ -365,6 +365,10 @@
bool 'Support for RTAS (RunTime Abstraction Services) in /proc' CONFIG_PPC_RTAS
bool 'Support for PReP Residual Data' CONFIG_PREP_RESIDUAL
dep_bool ' Support for reading of PReP Residual Data in /proc' CONFIG_PROC_PREPRESIDUAL $CONFIG_PREP_RESIDUAL
+ define_bool CONFIG_PPCBUG_NVRAM y
+fi
+if [ "$CONFIG_PPLUS" = "y" -o "$CONFIG_LOPEC" = "y" ]; then
+ bool 'Enable reading PPCBUG NVRAM during boot' CONFIG_PPCBUG_NVRAM
fi
bool 'Default bootloader kernel arguments' CONFIG_CMDLINE_BOOL
diff -Nru a/arch/ppc/kernel/Makefile b/arch/ppc/kernel/Makefile
--- a/arch/ppc/kernel/Makefile Thu Aug 1 14:17:40 2002
+++ b/arch/ppc/kernel/Makefile Thu Aug 1 14:17:40 2002
@@ -35,6 +35,7 @@
ifneq ($(CONFIG_PPC_ISERIES),y)
obj-$(CONFIG_PCI) += pci-dma.o
endif
+obj-$(CONFIG_PPCBUG_NVRAM) += prep_nvram.o
obj-$(CONFIG_KGDB) += ppc-stub.o
obj-$(CONFIG_SMP) += smp.o
obj-$(CONFIG_TAU) += temp.o
diff -Nru a/arch/ppc/kernel/irq.c b/arch/ppc/kernel/irq.c
--- a/arch/ppc/kernel/irq.c Thu Aug 1 14:17:39 2002
+++ b/arch/ppc/kernel/irq.c Thu Aug 1 14:17:39 2002
@@ -178,15 +178,6 @@
return 0;
}
-#if (defined(CONFIG_8xx) || defined(CONFIG_8260))
-/* Name change so we can catch standard drivers that potentially mess up
- * the internal interrupt controller on 8xx and 8260. Just bear with me,
- * I don't like this either and I am searching a better solution. For
- * now, this is what I need. -- Dan
- */
-#define request_irq request_8xxirq
-#endif
-
void free_irq(unsigned int irq, void* dev_id)
{
irq_desc_t *desc;
@@ -212,11 +203,7 @@
}
spin_unlock_irqrestore(&desc->lock,flags);
-#ifdef CONFIG_SMP
- /* Wait to make sure it's not being used on another CPU */
- while (desc->status & IRQ_INPROGRESS)
- barrier();
-#endif
+ synchronize_irq(irq);
irq_kfree(action);
return;
}
@@ -289,8 +276,8 @@
*
* This function may be called from IRQ context.
*/
-
- void disable_irq_nosync(unsigned int irq)
+
+void disable_irq_nosync(unsigned int irq)
{
irq_desc_t *desc = irq_desc + irq;
unsigned long flags;
@@ -320,12 +307,7 @@
void disable_irq(unsigned int irq)
{
disable_irq_nosync(irq);
-
- if (!local_irq_count(smp_processor_id())) {
- do {
- barrier();
- } while (irq_desc[irq].status & IRQ_INPROGRESS);
- }
+ synchronize_irq(irq);
}
/**
@@ -525,11 +507,10 @@
}
#ifndef CONFIG_PPC_ISERIES /* iSeries version is in iSeries_pic.c */
-int do_IRQ(struct pt_regs *regs)
+void do_IRQ(struct pt_regs *regs)
{
- int cpu = smp_processor_id();
int irq, first = 1;
- hardirq_enter( cpu );
+ irq_enter();
/*
* Every platform is required to implement ppc_md.get_irq.
@@ -546,11 +527,7 @@
if (irq != -2 && first)
/* That's not SMP safe ... but who cares ? */
ppc_spurious_interrupts++;
- hardirq_exit( cpu );
-
- if (softirq_pending(cpu))
- do_softirq();
- return 1; /* lets ret_from_int know we can do checks */
+ irq_exit();
}
#endif /* CONFIG_PPC_ISERIES */
@@ -582,262 +559,14 @@
}
#ifdef CONFIG_SMP
-unsigned char global_irq_holder = NO_PROC_ID;
-unsigned volatile long global_irq_lock; /* pendantic :long for set_bit--RR*/
-
-atomic_t global_bh_count;
-
-static void show(char * str)
+void synchronize_irq(unsigned int irq)
{
- int cpu = smp_processor_id();
-
- printk("\n%s, CPU %d:\n", str, cpu);
- printk("irq: [%d %d]\n",
- local_irq_count(0),
- local_irq_count(1));
- printk("bh: %d [%d %d]\n",
- atomic_read(&global_bh_count),
- local_bh_count(0),
- local_bh_count(1));
-}
-
-static inline void wait_on_bh(void)
-{
- int count = MAXCOUNT;
- do {
- if (!--count) {
- show("wait_on_bh");
- count = ~0;
- }
- /* nothing .. wait for the other bh's to go away */
- } while (atomic_read(&global_bh_count) != 0);
-}
-
-
-static inline void wait_on_irq(int cpu)
-{
- int count = MAXCOUNT;
-
- for (;;) {
-
- /*
- * Wait until all interrupts are gone. Wait
- * for bottom half handlers unless we're
- * already executing in one..
- */
- if (!irqs_running())
- if (local_bh_count(cpu) || !spin_is_locked(&global_bh_lock))
- break;
-
- /* Duh, we have to loop. Release the lock to avoid deadlocks */
- clear_bit(0,&global_irq_lock);
-
- for (;;) {
- if (!--count) {
- show("wait_on_irq");
- count = ~0;
- }
- local_irq_enable();
- /*
- * We have to allow irqs to arrive between local_irq_enable and local_irq_disable
- * Some cpus apparently won't cause the interrupt
- * for several instructions. We hope that isync will
- * catch this --Troy
- */
- __asm__ __volatile__ ("isync");
- local_irq_disable();
- if (irqs_running())
- continue;
- if (global_irq_lock)
- continue;
- if (!local_bh_count(cpu) && spin_is_locked(&global_bh_lock))
- continue;
- if (!test_and_set_bit(0,&global_irq_lock))
- break;
- }
- }
-}
-
-/*
- * This is called when we want to synchronize with
- * bottom half handlers. We need to wait until
- * no other CPU is executing any bottom half handler.
- *
- * Don't wait if we're already running in an interrupt
- * context or are inside a bh handler.
- */
-void synchronize_bh(void)
-{
- if (atomic_read(&global_bh_count) && !in_interrupt())
- wait_on_bh();
-}
-
-/*
- * This is called when we want to synchronize with
- * interrupts. We may for example tell a device to
- * stop sending interrupts: but to make sure there
- * are no interrupts that are executing on another
- * CPU we need to call this function.
- */
-void synchronize_irq(void)
-{
- if (irqs_running()) {
- /* Stupid approach */
- cli();
- sti();
- }
-}
-
-static inline void get_irqlock(int cpu)
-{
- unsigned int loops = MAXCOUNT;
-
- if (test_and_set_bit(0,&global_irq_lock)) {
- /* do we already hold the lock? */
- if ((unsigned char) cpu == global_irq_holder)
- return;
- /* Uhhuh.. Somebody else got it. Wait.. */
- do {
- do {
- if (loops-- == 0) {
- printk("get_irqlock(%d) waiting, global_irq_holder=%d\n", cpu, global_irq_holder);
-#ifdef CONFIG_XMON
- xmon(0);
-#endif
- }
- } while (test_bit(0,&global_irq_lock));
- } while (test_and_set_bit(0,&global_irq_lock));
- }
- /*
- * We also need to make sure that nobody else is running
- * in an interrupt context.
- */
- wait_on_irq(cpu);
-
- /*
- * Ok, finally..
- */
- global_irq_holder = cpu;
-}
-
-/*
- * A global "cli()" while in an interrupt context
- * turns into just a local cli(). Interrupts
- * should use spinlocks for the (very unlikely)
- * case that they ever want to protect against
- * each other.
- *
- * If we already have local interrupts disabled,
- * this will not turn a local disable into a
- * global one (problems with spinlocks: this makes
- * save_flags+cli+sti usable inside a spinlock).
- */
-void __global_cli(void)
-{
- unsigned long flags;
-
- local_save_flags(flags);
- if (flags & (1 << 15)) {
- int cpu = smp_processor_id();
- local_irq_disable();
- if (!local_irq_count(cpu))
- get_irqlock(cpu);
- }
-}
-
-void __global_sti(void)
-{
- int cpu = smp_processor_id();
-
- if (!local_irq_count(cpu))
- release_irqlock(cpu);
- local_irq_enable();
-}
-
-/*
- * SMP flags value to restore to:
- * 0 - global cli
- * 1 - global sti
- * 2 - local cli
- * 3 - local sti
- */
-unsigned long __global_save_flags(void)
-{
- int retval;
- int local_enabled;
- unsigned long flags;
-
- local_save_flags(flags);
- local_enabled = (flags >> 15) & 1;
- /* default to local */
- retval = 2 + local_enabled;
-
- /* check for global flags if we're not in an interrupt */
- if (!local_irq_count(smp_processor_id())) {
- if (local_enabled)
- retval = 1;
- if (global_irq_holder == (unsigned char) smp_processor_id())
- retval = 0;
- }
- return retval;
-}
-
-int
-tb(long vals[],
- int max_size)
-{
- register unsigned long *orig_sp __asm__ ("r1");
- register unsigned long lr __asm__ ("r3");
- unsigned long *sp;
- int i;
-
- asm volatile ("mflr 3");
- vals[0] = lr;
- sp = (unsigned long *) *orig_sp;
- sp = (unsigned long *) *sp;
- for (i=1; i= Hash_size>>10 )
- return -EINVAL;
-
- /* minimum size of htab */
- if ( size < 64 )
- return -EINVAL;
-
- /* make sure it's a multiple of 64k */
- if ( size % 64 )
- return -EINVAL;
-
- printk("Hash table resize to %luk\n", size);
- /*
- * We need to rehash all kernel entries for the new htab size.
- * Kernel only since we do a flush_tlb_all(). Since it's kernel
- * we only need to bother with vsids 0-15. To avoid problems of
- * clobbering un-rehashed values we put the htab at a new spot
- * and put everything there.
- * -- Cort
- */
- Hash_size = size<<10;
- Hash_mask = (Hash_size >> 6) - 1;
- _SDR1 = __pa(Hash) | (Hash_mask >> 10);
- flush_tlb_all();
-
- reset_SDR1();
-#endif
return count;
#else /* CONFIG_PPC_STD_MMU */
return 0;
diff -Nru a/arch/ppc/kernel/ppc_ksyms.c b/arch/ppc/kernel/ppc_ksyms.c
--- a/arch/ppc/kernel/ppc_ksyms.c Thu Aug 1 14:17:41 2002
+++ b/arch/ppc/kernel/ppc_ksyms.c Thu Aug 1 14:17:41 2002
@@ -207,12 +207,6 @@
EXPORT_SYMBOL(giveup_altivec);
#endif /* CONFIG_ALTIVEC */
#ifdef CONFIG_SMP
-EXPORT_SYMBOL(global_irq_lock);
-EXPORT_SYMBOL(global_irq_holder);
-EXPORT_SYMBOL(__global_cli);
-EXPORT_SYMBOL(__global_sti);
-EXPORT_SYMBOL(__global_save_flags);
-EXPORT_SYMBOL(__global_restore_flags);
#ifdef CONFIG_DEBUG_SPINLOCK
EXPORT_SYMBOL(_raw_spin_lock);
EXPORT_SYMBOL(_raw_spin_unlock);
diff -Nru a/arch/ppc/kernel/prep_nvram.c b/arch/ppc/kernel/prep_nvram.c
--- /dev/null Wed Dec 31 16:00:00 1969
+++ b/arch/ppc/kernel/prep_nvram.c Thu Aug 1 14:17:40 2002
@@ -0,0 +1,148 @@
+/*
+ * BK Id: %F% %I% %G% %U% %#%
+ */
+/*
+ * arch/ppc/kernel/prep_nvram.c
+ *
+ * Copyright (C) 1998 Corey Minyard
+ *
+ * This reads the NvRAM on PReP compliant machines (generally from IBM or
+ * Motorola). Motorola kept the format of NvRAM in their ROM, PPCBUG, the
+ * same, long after they had stopped producing PReP compliant machines. So
+ * this code is useful in those cases as well.
+ *
+ */
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+#include
+#include
+
+static char nvramData[MAX_PREP_NVRAM];
+static NVRAM_MAP *nvram=(NVRAM_MAP *)&nvramData[0];
+
+unsigned char __prep prep_nvram_read_val(int addr)
+{
+ outb(addr, PREP_NVRAM_AS0);
+ outb(addr>>8, PREP_NVRAM_AS1);
+ return inb(PREP_NVRAM_DATA);
+}
+
+void __prep prep_nvram_write_val(int addr,
+ unsigned char val)
+{
+ outb(addr, PREP_NVRAM_AS0);
+ outb(addr>>8, PREP_NVRAM_AS1);
+ outb(val, PREP_NVRAM_DATA);
+}
+
+void __init init_prep_nvram(void)
+{
+ unsigned char *nvp;
+ int i;
+ int nvramSize;
+
+ /*
+ * The following could fail if the NvRAM were corrupt but
+ * we expect the boot firmware to have checked its checksum
+ * before boot
+ */
+ nvp = (char *) &nvram->Header;
+ for (i=0; iHeader.GEAddress+nvram->Header.GELength;
+ if(nvramSize>MAX_PREP_NVRAM)
+ {
+ /*
+ * NvRAM is too large
+ */
+ nvram->Header.GELength=0;
+ return;
+ }
+
+ /*
+ * Read the remainder of the PReP NvRAM
+ */
+ nvp = (char *) &nvram->GEArea[0];
+ for (i=sizeof(HEADER); iHeader.GELength == 0) {
+ return NULL;
+ } else {
+ return (((char *)nvram)
+ + ((unsigned int) nvram->Header.GEAddress));
+ }
+}
+
+__prep
+char __prep *prep_nvram_next_var(char *name)
+{
+ char *cp;
+
+
+ cp = name;
+ while (((cp - ((char *) nvram->GEArea)) < nvram->Header.GELength)
+ && (*cp != '\0'))
+ {
+ cp++;
+ }
+
+ /* Skip over any null characters. */
+ while (((cp - ((char *) nvram->GEArea)) < nvram->Header.GELength)
+ && (*cp == '\0'))
+ {
+ cp++;
+ }
+
+ if ((cp - ((char *) nvram->GEArea)) < nvram->Header.GELength) {
+ return cp;
+ } else {
+ return NULL;
+ }
+}
+
+
+
diff -Nru a/arch/ppc/kernel/process.c b/arch/ppc/kernel/process.c
--- a/arch/ppc/kernel/process.c Thu Aug 1 14:17:40 2002
+++ b/arch/ppc/kernel/process.c Thu Aug 1 14:17:40 2002
@@ -202,8 +202,7 @@
struct thread_struct *new_thread, *old_thread;
unsigned long s;
- local_save_flags(s);
- local_irq_disable();
+ local_irq_save(s);
#if CHECK_STACK
check_stack(prev);
check_stack(new);
diff -Nru a/arch/ppc/kernel/temp.c b/arch/ppc/kernel/temp.c
--- a/arch/ppc/kernel/temp.c Thu Aug 1 14:17:36 2002
+++ b/arch/ppc/kernel/temp.c Thu Aug 1 14:17:36 2002
@@ -124,27 +124,27 @@
void TAUException(struct pt_regs * regs)
{
- unsigned long cpu = smp_processor_id();
+ int cpu = smp_processor_id();
- hardirq_enter(cpu);
+ irq_enter();
tau[cpu].interrupts++;
TAUupdate(cpu);
- hardirq_exit(cpu);
- return;
+ irq_exit();
}
#endif /* CONFIG_TAU_INT */
static void tau_timeout(void * info)
{
- unsigned long cpu = smp_processor_id();
+ int cpu;
unsigned long flags;
int size;
int shrink;
/* disabling interrupts *should* be okay */
- save_flags(flags); cli();
+ local_irq_save(flags);
+ cpu = smp_processor_id();
#ifndef CONFIG_TAU_INT
TAUupdate(cpu);
@@ -186,7 +186,7 @@
*/
mtspr(SPRN_THRM3, THRM3_SITV(500*60) | THRM3_E);
- restore_flags(flags);
+ local_irq_restore(flags);
}
static void tau_timeout_smp(unsigned long unused)
diff -Nru a/arch/ppc/kernel/time.c b/arch/ppc/kernel/time.c
--- a/arch/ppc/kernel/time.c Thu Aug 1 14:17:37 2002
+++ b/arch/ppc/kernel/time.c Thu Aug 1 14:17:37 2002
@@ -75,7 +75,7 @@
unsigned long disarm_decr[NR_CPUS];
-extern int do_sys_settimeofday(struct timeval *tv, struct timezone *tz);
+extern struct timezone sys_tz;
/* keep track of when we need to update the rtc */
time_t last_rtc_update;
@@ -151,7 +151,7 @@
* with interrupts disabled.
* We set it up to overflow again in 1/HZ seconds.
*/
-int timer_interrupt(struct pt_regs * regs)
+void timer_interrupt(struct pt_regs * regs)
{
int next_dec;
unsigned long cpu = smp_processor_id();
@@ -161,7 +161,7 @@
if (atomic_read(&ppc_n_lost_interrupts) != 0)
do_IRQ(regs);
- hardirq_enter(cpu);
+ irq_enter();
while ((next_dec = tb_ticks_per_jiffy - tb_delta(&jiffy_stamp)) < 0) {
jiffy_stamp += tb_ticks_per_jiffy;
@@ -214,12 +214,7 @@
if (ppc_md.heartbeat && !ppc_md.heartbeat_count--)
ppc_md.heartbeat();
- hardirq_exit(cpu);
-
- if (softirq_pending(cpu))
- do_softirq();
-
- return 1; /* lets ret_from_int know we can do checks */
+ irq_exit();
}
#endif /* CONFIG_PPC_ISERIES */
@@ -358,14 +353,11 @@
/* Not exact, but the timer interrupt takes care of this */
set_dec(tb_ticks_per_jiffy);
- /* If platform provided a timezone (pmac), we correct the time
- * using do_sys_settimeofday() which in turn calls warp_clock()
- */
+ /* If platform provided a timezone (pmac), we correct the time */
if (time_offset) {
- struct timezone tz;
- tz.tz_minuteswest = -time_offset / 60;
- tz.tz_dsttime = 0;
- do_sys_settimeofday(NULL, &tz);
+ sys_tz.tz_minuteswest = -time_offset / 60;
+ sys_tz.tz_dsttime = 0;
+ xtime.tv_sec -= time_offset;
}
}
@@ -373,6 +365,11 @@
#define STARTOFTIME 1970
#define SECDAY 86400L
#define SECYR (SECDAY * 365)
+
+/*
+ * Note: this is wrong for 2100, but our signed 32-bit time_t will
+ * have overflowed long before that, so who cares. -- paulus
+ */
#define leapyear(year) ((year) % 4 == 0)
#define days_in_year(a) (leapyear(a) ? 366 : 365)
#define days_in_month(a) (month_days[(a) - 1])
diff -Nru a/arch/ppc/mm/fault.c b/arch/ppc/mm/fault.c
--- a/arch/ppc/mm/fault.c Thu Aug 1 14:17:39 2002
+++ b/arch/ppc/mm/fault.c Thu Aug 1 14:17:39 2002
@@ -189,16 +189,18 @@
*/
survive:
switch (handle_mm_fault(mm, vma, address, is_write)) {
- case 1:
+ case VM_FAULT_MINOR:
current->min_flt++;
break;
- case 2:
+ case VM_FAULT_MAJOR:
current->maj_flt++;
break;
- case 0:
+ case VM_FAULT_SIGBUS:
goto do_sigbus;
- default:
+ case VM_FAULT_OOM:
goto out_of_memory;
+ default:
+ BUG();
}
up_read(&mm->mmap_sem);
diff -Nru a/arch/ppc/mm/mmu_decl.h b/arch/ppc/mm/mmu_decl.h
--- a/arch/ppc/mm/mmu_decl.h Thu Aug 1 14:17:40 2002
+++ b/arch/ppc/mm/mmu_decl.h Thu Aug 1 14:17:40 2002
@@ -25,7 +25,6 @@
#include
extern void mapin_ram(void);
-extern void bat_mapin_ram(void);
extern int map_page(unsigned long va, unsigned long pa, int flags);
extern void setbat(int index, unsigned long virt, unsigned long phys,
unsigned int size, int flags);
@@ -49,14 +48,17 @@
#if defined(CONFIG_8xx)
#define flush_HPTE(X, va, pg) _tlbie(va)
#define MMU_init_hw() do { } while(0)
+#define mmu_mapin_ram() (0UL)
#elif defined(CONFIG_4xx)
#define flush_HPTE(X, va, pg) _tlbie(va)
extern void MMU_init_hw(void);
+#define mmu_mapin_ram() (0UL)
#else
/* anything except 4xx or 8xx */
extern void MMU_init_hw(void);
+extern unsigned long mmu_mapin_ram(void);
/* Be careful....this needs to be updated if we ever encounter 603 SMPs,
* which includes all new 82xx processors. We need tlbie/tlbsync here
diff -Nru a/arch/ppc/mm/pgtable.c b/arch/ppc/mm/pgtable.c
--- a/arch/ppc/mm/pgtable.c Thu Aug 1 14:17:36 2002
+++ b/arch/ppc/mm/pgtable.c Thu Aug 1 14:17:36 2002
@@ -252,31 +252,14 @@
{
unsigned long v, p, s, f;
-#ifdef HAVE_BATS
- if (!__map_without_bats)
- bat_mapin_ram();
-#endif /* HAVE_BATS */
-
- v = KERNELBASE;
- p = PPC_MEMSTART;
- for (s = 0; s < total_lowmem; s += PAGE_SIZE) {
- /* On the MPC8xx, we want the page shared so we
- * don't get ASID compares on kernel space.
- */
- f = _PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_SHARED | _PAGE_HWEXEC;
-#if defined(CONFIG_KGDB) || defined(CONFIG_XMON)
- /* Allows stub to set breakpoints everywhere */
- f |= _PAGE_WRENABLE;
-#else /* !CONFIG_KGDB && !CONFIG_XMON */
- if ((char *) v < _stext || (char *) v >= etext)
- f |= _PAGE_WRENABLE;
-#ifdef CONFIG_PPC_STD_MMU
+ s = mmu_mapin_ram();
+ v = KERNELBASE + s;
+ p = PPC_MEMSTART + s;
+ for (; s < total_lowmem; s += PAGE_SIZE) {
+ if ((char *) v >= _stext && (char *) v < etext)
+ f = _PAGE_RAM_TEXT;
else
- /* On the powerpc (not all), no user access
- forces R/W kernel access */
- f |= _PAGE_USER;
-#endif /* CONFIG_PPC_STD_MMU */
-#endif /* CONFIG_KGDB || CONFIG_XMON */
+ f = _PAGE_RAM;
map_page(v, p, f);
v += PAGE_SIZE;
p += PAGE_SIZE;
diff -Nru a/arch/ppc/mm/ppc_mmu.c b/arch/ppc/mm/ppc_mmu.c
--- a/arch/ppc/mm/ppc_mmu.c Thu Aug 1 14:17:36 2002
+++ b/arch/ppc/mm/ppc_mmu.c Thu Aug 1 14:17:36 2002
@@ -87,12 +87,15 @@
return 0;
}
-void __init bat_mapin_ram(void)
+unsigned long __init mmu_mapin_ram(void)
{
unsigned long tot, bl, done;
unsigned long max_size = (256<<20);
unsigned long align;
+ if (__map_without_bats)
+ return 0;
+
/* Set up BAT2 and if necessary BAT3 to cover RAM. */
/* Make sure we don't map a block larger than the
@@ -119,7 +122,10 @@
break;
setbat(3, KERNELBASE+done, PPC_MEMSTART+done, bl,
_PAGE_KERNEL);
+ done = (unsigned long)bat_addrs[3].limit - KERNELBASE + 1;
}
+
+ return done;
}
/*
diff -Nru a/arch/ppc/mm/tlb.c b/arch/ppc/mm/tlb.c
--- a/arch/ppc/mm/tlb.c Thu Aug 1 14:17:41 2002
+++ b/arch/ppc/mm/tlb.c Thu Aug 1 14:17:41 2002
@@ -31,13 +31,42 @@
#include
#include
#include
+#include
+#include
#include "mmu_decl.h"
/*
+ * Called when unmapping pages to flush entries from the TLB/hash table.
+ */
+void flush_hash_entry(struct mm_struct *mm, pte_t *ptep, unsigned long addr)
+{
+ unsigned long ptephys;
+
+ if (Hash != 0) {
+ ptephys = __pa(ptep) & PAGE_MASK;
+ flush_hash_pages(mm->context, addr, ptephys, 1);
+ }
+}
+
+/*
+ * Called at the end of a mmu_gather operation to make sure the
+ * TLB flush is completely done.
+ */
+void tlb_flush(mmu_gather_t *tlb)
+{
+ if (Hash == 0) {
+ /*
+ * 603 needs to flush the whole TLB here since
+ * it doesn't use a hash table.
+ */
+ _tlbia();
+ }
+}
+
+/*
* TLB flushing:
*
- * - flush_tlb_all() flushes all processes TLBs
* - flush_tlb_mm(mm) flushes the specified mm context TLB's
* - flush_tlb_page(vma, vmaddr) flushes one page
* - flush_tlb_range(vma, start, end) flushes a range of pages
@@ -92,29 +121,6 @@
}
/*
- * Flush all tlb/hash table entries (except perhaps for those
- * mapping RAM starting at PAGE_OFFSET, since they never change).
- */
-void
-flush_tlb_all(void)
-{
- /*
- * Just flush the kernel part of the address space, that's
- * all that the current callers of this require.
- * Eventually I hope to persuade the powers that be that
- * we can and should dispense with flush_tlb_all().
- * -- paulus.
- *
- * In fact this should never get called now that we
- * have flush_tlb_kernel_range. -- paulus
- */
- printk(KERN_ERR "flush_tlb_all called from %p\n",
- __builtin_return_address(0));
- flush_range(&init_mm, TASK_SIZE, ~0UL);
- FINISH_FLUSH;
-}
-
-/*
* Flush kernel TLB entries in the given range
*/
void flush_tlb_kernel_range(unsigned long start, unsigned long end)
@@ -124,24 +130,19 @@
}
/*
- * Flush all the (user) entries for the address space described
- * by mm. We can't rely on mm->mmap describing all the entries
- * that might be in the hash table.
+ * Flush all the (user) entries for the address space described by mm.
*/
void flush_tlb_mm(struct mm_struct *mm)
{
+ struct vm_area_struct *mp;
+
if (Hash == 0) {
_tlbia();
return;
}
- if (mm->map_count) {
- struct vm_area_struct *mp;
- for (mp = mm->mmap; mp != NULL; mp = mp->vm_next)
- flush_range(mp->vm_mm, mp->vm_start, mp->vm_end);
- } else {
- flush_range(mm, 0, TASK_SIZE);
- }
+ for (mp = mm->mmap; mp != NULL; mp = mp->vm_next)
+ flush_range(mp->vm_mm, mp->vm_start, mp->vm_end);
FINISH_FLUSH;
}
@@ -160,7 +161,6 @@
flush_hash_pages(mm->context, vmaddr, pmd_val(*pmd), 1);
FINISH_FLUSH;
}
-
/*
* For each address in the range, find the pte for the address
diff -Nru a/arch/ppc/platforms/Makefile b/arch/ppc/platforms/Makefile
--- a/arch/ppc/platforms/Makefile Thu Aug 1 14:17:40 2002
+++ b/arch/ppc/platforms/Makefile Thu Aug 1 14:17:40 2002
@@ -32,7 +32,7 @@
obj-$(CONFIG_ALL_PPC) += pmac_pic.o pmac_setup.o pmac_time.o \
pmac_feature.o pmac_pci.o chrp_setup.o\
chrp_time.o chrp_pci.o prep_pci.o \
- prep_time.o prep_nvram.o prep_setup.o
+ prep_time.o prep_setup.o
ifeq ($(CONFIG_ALL_PPC),y)
obj-$(CONFIG_NVRAM) += pmac_nvram.o
endif
@@ -50,7 +50,7 @@
obj-$(CONFIG_MVME5100) += mvme5100_setup.o mvme5100_pci.o
obj-$(CONFIG_PCORE) += pcore_setup.o pcore_pci.o
obj-$(CONFIG_POWERPMC250) += powerpmc250.o
-obj-$(CONFIG_PPLUS) += pplus_pci.o pplus_setup.o prep_nvram.o
+obj-$(CONFIG_PPLUS) += pplus_pci.o pplus_setup.o
obj-$(CONFIG_PRPMC750) += prpmc750_setup.o prpmc750_pci.o
obj-$(CONFIG_PRPMC800) += prpmc800_setup.o prpmc800_pci.o
obj-$(CONFIG_SANDPOINT) += sandpoint_setup.o sandpoint_pci.o
diff -Nru a/arch/ppc/platforms/cpc700.h b/arch/ppc/platforms/cpc700.h
--- a/arch/ppc/platforms/cpc700.h Thu Aug 1 14:17:40 2002
+++ b/arch/ppc/platforms/cpc700.h Thu Aug 1 14:17:40 2002
@@ -6,7 +6,7 @@
* Author: Mark A. Greer
* mgreer@mvista.com
*
- * Copyright 2000 MontaVista Software Inc.
+ * Copyright 2000-2002 MontaVista Software Inc.
*
* 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
@@ -101,7 +101,7 @@
* UIC Exports...
*/
extern struct hw_interrupt_type cpc700_pic;
-extern unsigned int cpc700_irq_assigns[27][2];
+extern unsigned int cpc700_irq_assigns[32][2];
extern void __init cpc700_init_IRQ(void);
extern int cpc700_get_irq(struct pt_regs *);
diff -Nru a/arch/ppc/platforms/cpc700_pic.c b/arch/ppc/platforms/cpc700_pic.c
--- a/arch/ppc/platforms/cpc700_pic.c Thu Aug 1 14:17:37 2002
+++ b/arch/ppc/platforms/cpc700_pic.c Thu Aug 1 14:17:37 2002
@@ -8,7 +8,7 @@
* mporter@mvista.com
* jpeters@mvista.com
*
- * Copyright 2001 MontaVista Software Inc.
+ * Copyright 2001-2002 MontaVista Software Inc.
*
* 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
@@ -168,7 +168,7 @@
cpc700_pic_init_irq(i);
}
- for (i = 20; i < 27; i++) {
+ for (i = 20; i < 32; i++) {
irq_desc[i].handler = &cpc700_pic;
cpc700_pic_init_irq(i);
}
diff -Nru a/arch/ppc/platforms/iSeries_pic.c b/arch/ppc/platforms/iSeries_pic.c
--- a/arch/ppc/platforms/iSeries_pic.c Thu Aug 1 14:17:40 2002
+++ b/arch/ppc/platforms/iSeries_pic.c Thu Aug 1 14:17:40 2002
@@ -42,7 +42,7 @@
extern void iSeries_smp_message_recv( struct pt_regs * );
unsigned lpEvent_count = 0;
-int do_IRQ(struct pt_regs *regs)
+void do_IRQ(struct pt_regs *regs)
{
int cpu = smp_processor_id();
unsigned long flags;
@@ -52,7 +52,7 @@
if ( is_soft_enabled() )
BUG();
- hardirq_enter( cpu );
+ irq_enter();
paca = (struct Paca *)mfspr(SPRG1);
@@ -65,21 +65,16 @@
lpq = paca->lpQueuePtr;
if ( lpq ) {
- local_save_flags( flags );
- local_irq_disable();
+ local_irq_save(flags);
lpEvent_count += ItLpQueue_process( lpq, regs );
local_irq_restore( flags );
}
- hardirq_exit( cpu );
+ irq_exit();
if ( paca->xLpPacaPtr->xDecrInt ) {
paca->xLpPacaPtr->xDecrInt = 0;
/* Signal a fake decrementer interrupt */
timer_interrupt( regs );
}
-
- if (softirq_pending(cpu))
- do_softirq();
- return 1; /* lets ret_from_int know we can do checks */
}
diff -Nru a/arch/ppc/platforms/iSeries_time.c b/arch/ppc/platforms/iSeries_time.c
--- a/arch/ppc/platforms/iSeries_time.c Thu Aug 1 14:17:40 2002
+++ b/arch/ppc/platforms/iSeries_time.c Thu Aug 1 14:17:40 2002
@@ -102,7 +102,7 @@
int timerRetDisabled = 0;
extern unsigned long iSeries_dec_value;
-int timer_interrupt(struct pt_regs * regs)
+void timer_interrupt(struct pt_regs * regs)
{
long next_dec;
struct Paca * paca;
@@ -117,7 +117,7 @@
else
timerRetDisabled++;
- hardirq_enter(cpu);
+ irq_enter();
if (!user_mode(regs))
ppc_do_profile(instruction_pointer(regs));
@@ -149,9 +149,5 @@
paca->xLpPacaPtr->xDecrInt = 0;
set_dec( (unsigned)next_dec );
- hardirq_exit(cpu);
-
- if (softirq_pending(cpu))
- do_softirq();
- return 1;
+ irq_exit();
}
diff -Nru a/arch/ppc/platforms/lopec_setup.c b/arch/ppc/platforms/lopec_setup.c
--- a/arch/ppc/platforms/lopec_setup.c Thu Aug 1 14:17:36 2002
+++ b/arch/ppc/platforms/lopec_setup.c Thu Aug 1 14:17:36 2002
@@ -33,7 +33,9 @@
#include
#include
#include
+#include
+extern char saved_command_line[];
extern void lopec_find_bridges(void);
/*
@@ -332,6 +334,21 @@
#ifdef CONFIG_DUMMY_CONSOLE
conswitchp = &dummy_con;
+#endif
+#ifdef CONFIG_PPCBUG_NVRAM
+ /* Read in NVRAM data */
+ init_prep_nvram();
+
+ /* if no bootargs, look in NVRAM */
+ if ( cmd_line[0] == '\0' ) {
+ char *bootargs;
+ bootargs = prep_nvram_get_var("bootargs");
+ if (bootargs != NULL) {
+ strcpy(cmd_line, bootargs);
+ /* again.. */
+ strcpy(saved_command_line, cmd_line);
+ }
+ }
#endif
}
diff -Nru a/arch/ppc/platforms/pplus_setup.c b/arch/ppc/platforms/pplus_setup.c
--- a/arch/ppc/platforms/pplus_setup.c Thu Aug 1 14:17:41 2002
+++ b/arch/ppc/platforms/pplus_setup.c Thu Aug 1 14:17:41 2002
@@ -9,7 +9,7 @@
* Cort Dougan, Johnnie Peters, Matt Porter, and
* Troy Benjegerdes.
*
- * Copyright 2001 MontaVista Software Inc.
+ * Copyright 2001-2002 MontaVista Software Inc.
*
* 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
@@ -76,8 +76,9 @@
TODC_ALLOC();
-extern void pplus_setup_hose(void);
+extern char saved_command_line[];
+extern void pplus_setup_hose(void);
extern void pplus_set_VIA_IDE_native(void);
extern unsigned long loops_per_jiffy;
@@ -131,7 +132,8 @@
ROOT_DEV = Root_SDA2;
#endif
- printk("PowerPlus port (C) 2001 MontaVista Software, Inc. (source@mvista.com)\n");
+ printk(KERN_INFO "Motorola PowerPlus Platform\n");
+ printk(KERN_INFO "Port by MontaVista Software, Inc. (source@mvista.com)\n");
if ( ppc_md.progress )
ppc_md.progress("pplus_setup_arch: raven_init\n", 0);
@@ -144,6 +146,21 @@
conswitchp = &vga_con;
#elif defined(CONFIG_DUMMY_CONSOLE)
conswitchp = &dummy_con;
+#endif
+#ifdef CONFIG_PPCBUG_NVRAM
+ /* Read in NVRAM data */
+ init_prep_nvram();
+
+ /* if no bootargs, look in NVRAM */
+ if ( cmd_line[0] == '\0' ) {
+ char *bootargs;
+ bootargs = prep_nvram_get_var("bootargs");
+ if (bootargs != NULL) {
+ strcpy(cmd_line, bootargs);
+ /* again.. */
+ strcpy(saved_command_line, cmd_line);
+ }
+ }
#endif
if ( ppc_md.progress )
ppc_md.progress("pplus_setup_arch: exit\n", 0);
diff -Nru a/arch/ppc/platforms/prep_nvram.c b/arch/ppc/platforms/prep_nvram.c
--- a/arch/ppc/platforms/prep_nvram.c Thu Aug 1 14:17:40 2002
+++ /dev/null Wed Dec 31 16:00:00 1969
@@ -1,143 +0,0 @@
-/*
- * BK Id: %F% %I% %G% %U% %#%
- */
-/*
- * arch/ppc/platforms/prep_nvram.c
- *
- * Copyright (C) 1998 Corey Minyard
- *
- */
-#include
-#include
-#include
-#include
-
-#include
-#include
-#include
-#include
-#include
-#include
-
-static char nvramData[MAX_PREP_NVRAM];
-static NVRAM_MAP *nvram=(NVRAM_MAP *)&nvramData[0];
-
-unsigned char __prep prep_nvram_read_val(int addr)
-{
- outb(addr, PREP_NVRAM_AS0);
- outb(addr>>8, PREP_NVRAM_AS1);
- return inb(PREP_NVRAM_DATA);
-}
-
-void __prep prep_nvram_write_val(int addr,
- unsigned char val)
-{
- outb(addr, PREP_NVRAM_AS0);
- outb(addr>>8, PREP_NVRAM_AS1);
- outb(val, PREP_NVRAM_DATA);
-}
-
-void __init init_prep_nvram(void)
-{
- unsigned char *nvp;
- int i;
- int nvramSize;
-
- /*
- * The following could fail if the NvRAM were corrupt but
- * we expect the boot firmware to have checked its checksum
- * before boot
- */
- nvp = (char *) &nvram->Header;
- for (i=0; iHeader.GEAddress+nvram->Header.GELength;
- if(nvramSize>MAX_PREP_NVRAM)
- {
- /*
- * NvRAM is too large
- */
- nvram->Header.GELength=0;
- return;
- }
-
- /*
- * Read the remainder of the PReP NvRAM
- */
- nvp = (char *) &nvram->GEArea[0];
- for (i=sizeof(HEADER); iHeader.GELength == 0) {
- return NULL;
- } else {
- return (((char *)nvram)
- + ((unsigned int) nvram->Header.GEAddress));
- }
-}
-
-__prep
-char __prep *prep_nvram_next_var(char *name)
-{
- char *cp;
-
-
- cp = name;
- while (((cp - ((char *) nvram->GEArea)) < nvram->Header.GELength)
- && (*cp != '\0'))
- {
- cp++;
- }
-
- /* Skip over any null characters. */
- while (((cp - ((char *) nvram->GEArea)) < nvram->Header.GELength)
- && (*cp == '\0'))
- {
- cp++;
- }
-
- if ((cp - ((char *) nvram->GEArea)) < nvram->Header.GELength) {
- return cp;
- } else {
- return NULL;
- }
-}
-
-
-
diff -Nru a/arch/ppc/platforms/spruce_setup.c b/arch/ppc/platforms/spruce_setup.c
--- a/arch/ppc/platforms/spruce_setup.c Thu Aug 1 14:17:36 2002
+++ b/arch/ppc/platforms/spruce_setup.c Thu Aug 1 14:17:36 2002
@@ -6,7 +6,7 @@
* Authors: Johnnie Peters
* Matt Porter
*
- * Copyright 2001 MontaVista Software Inc.
+ * Copyright 2001-2002 MontaVista Software Inc.
*
* 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
@@ -70,7 +70,7 @@
*
* First entry is the sensitivity (level/edge), second is the polarity.
*/
-unsigned int cpc700_irq_assigns[27][2] = {
+unsigned int cpc700_irq_assigns[32][2] = {
{ 1, 1 }, /* IRQ 0: ECC Correctable Error - rising edge */
{ 1, 1 }, /* IRQ 1: PCI Write Mem Range - rising edge */
{ 0, 1 }, /* IRQ 2: PCI Write Command Reg - active high */
diff -Nru a/arch/ppc64/kernel/Makefile b/arch/ppc64/kernel/Makefile
--- a/arch/ppc64/kernel/Makefile Thu Aug 1 14:17:41 2002
+++ b/arch/ppc64/kernel/Makefile Thu Aug 1 14:17:41 2002
@@ -9,7 +9,7 @@
O_TARGET := kernel.o
EXTRA_TARGETS := $(KHEAD)
-export-objs := ppc_ksyms.o setup.o
+export-objs := ppc_ksyms.o
obj-y := ppc_ksyms.o setup.o entry.o traps.o irq.o idle.o \
time.o process.o signal.o syscalls.o misc.o ptrace.o \
diff -Nru a/arch/ppc64/kernel/misc.S b/arch/ppc64/kernel/misc.S
--- a/arch/ppc64/kernel/misc.S Thu Aug 1 14:17:40 2002
+++ b/arch/ppc64/kernel/misc.S Thu Aug 1 14:17:40 2002
@@ -916,8 +916,8 @@
.llong .sys_rt_sigtimedwait
.llong .sys_rt_sigqueueinfo
.llong .sys_rt_sigsuspend
- .llong .sys_pread
- .llong .sys_pwrite /* 180 */
+ .llong .sys_pread64
+ .llong .sys_pwrite64 /* 180 */
.llong .sys_chown
.llong .sys_getcwd
.llong .sys_capget
diff -Nru a/arch/s390/kernel/entry.S b/arch/s390/kernel/entry.S
--- a/arch/s390/kernel/entry.S Thu Aug 1 14:17:36 2002
+++ b/arch/s390/kernel/entry.S Thu Aug 1 14:17:36 2002
@@ -520,8 +520,8 @@
.long sys_rt_sigtimedwait
.long sys_rt_sigqueueinfo
.long sys_rt_sigsuspend_glue
- .long sys_pread /* 180 */
- .long sys_pwrite
+ .long sys_pread64 /* 180 */
+ .long sys_pwrite64
.long sys_chown16
.long sys_getcwd
.long sys_capget
diff -Nru a/arch/s390/mm/init.c b/arch/s390/mm/init.c
--- a/arch/s390/mm/init.c Thu Aug 1 14:17:36 2002
+++ b/arch/s390/mm/init.c Thu Aug 1 14:17:36 2002
@@ -189,7 +189,7 @@
totalram_pages++;
}
printk ("Freeing unused kernel memory: %dk freed\n",
- (&__init_end - &__init_begin) >> 10);
+ ((unsigned long)&__init_end - (unsigned long)&__init_begin) >> 10);
}
#ifdef CONFIG_BLK_DEV_INITRD
diff -Nru a/arch/s390x/kernel/linux32.c b/arch/s390x/kernel/linux32.c
--- a/arch/s390x/kernel/linux32.c Thu Aug 1 14:17:36 2002
+++ b/arch/s390x/kernel/linux32.c Thu Aug 1 14:17:36 2002
@@ -3980,10 +3980,10 @@
}
-extern asmlinkage ssize_t sys_pread(unsigned int fd, char * buf,
+extern asmlinkage ssize_t sys_pread64(unsigned int fd, char * buf,
size_t count, loff_t pos);
-extern asmlinkage ssize_t sys_pwrite(unsigned int fd, const char * buf,
+extern asmlinkage ssize_t sys_pwrite64(unsigned int fd, const char * buf,
size_t count, loff_t pos);
typedef __kernel_ssize_t32 ssize_t32;
@@ -3991,13 +3991,13 @@
asmlinkage ssize_t32 sys32_pread(unsigned int fd, char *ubuf,
__kernel_size_t32 count, u32 poshi, u32 poslo)
{
- return sys_pread(fd, ubuf, count, ((loff_t)AA(poshi) << 32) | AA(poslo));
+ return sys_pread64(fd, ubuf, count, ((loff_t)AA(poshi) << 32) | AA(poslo));
}
asmlinkage ssize_t32 sys32_pwrite(unsigned int fd, char *ubuf,
__kernel_size_t32 count, u32 poshi, u32 poslo)
{
- return sys_pwrite(fd, ubuf, count, ((loff_t)AA(poshi) << 32) | AA(poslo));
+ return sys_pwrite64(fd, ubuf, count, ((loff_t)AA(poshi) << 32) | AA(poslo));
}
extern asmlinkage ssize_t sys_readahead(int fd, loff_t offset, size_t count);
diff -Nru a/arch/s390x/mm/init.c b/arch/s390x/mm/init.c
--- a/arch/s390x/mm/init.c Thu Aug 1 14:17:40 2002
+++ b/arch/s390x/mm/init.c Thu Aug 1 14:17:40 2002
@@ -201,7 +201,7 @@
totalram_pages++;
}
printk ("Freeing unused kernel memory: %ldk freed\n",
- (&__init_end - &__init_begin) >> 10);
+ ((unsigned long)&__init_end - (unsigned long)&__init_begin) >> 10);
}
#ifdef CONFIG_BLK_DEV_INITRD
diff -Nru a/arch/sh/kernel/Makefile b/arch/sh/kernel/Makefile
--- a/arch/sh/kernel/Makefile Thu Aug 1 14:17:40 2002
+++ b/arch/sh/kernel/Makefile Thu Aug 1 14:17:40 2002
@@ -5,7 +5,8 @@
O_TARGET := kernel.o
EXTRA_TARGETS := head.o init_task.o
-export-objs := io.o io_generic.o io_hd64461.o setup_hd64461.o sh_ksyms.o
+export-objs := io.o io_generic.o io_hd64465.o setup_hd64465.o sh_ksyms.o \
+ io_adx.o io_bigsur.o io_cat68701.o hd64465_gpio.o
obj-y := process.o signal.o entry.o traps.o irq.o irq_ipr.o \
ptrace.o setup.o time.o sys_sh.o semaphore.o \
diff -Nru a/arch/sparc/kernel/systbls.S b/arch/sparc/kernel/systbls.S
--- a/arch/sparc/kernel/systbls.S Thu Aug 1 14:17:40 2002
+++ b/arch/sparc/kernel/systbls.S Thu Aug 1 14:17:40 2002
@@ -31,7 +31,7 @@
/*50*/ .long sys_getegid16, sys_acct, sys_nis_syscall, sys_getgid, sys_ioctl
/*55*/ .long sys_reboot, sys_mmap2, sys_symlink, sys_readlink, sys_execve
/*60*/ .long sys_umask, sys_chroot, sys_newfstat, sys_fstat64, sys_getpagesize
-/*65*/ .long sys_msync, sys_vfork, sys_pread, sys_pwrite, sys_geteuid
+/*65*/ .long sys_msync, sys_vfork, sys_pread64, sys_pwrite64, sys_geteuid
/*70*/ .long sys_getegid, sys_mmap, sys_setreuid, sys_munmap, sys_mprotect
/*75*/ .long sys_madvise, sys_vhangup, sys_truncate64, sys_mincore, sys_getgroups16
/*80*/ .long sys_setgroups16, sys_getpgrp, sys_setgroups, sys_setitimer, sys_ftruncate64
diff -Nru a/arch/sparc/mm/init.c b/arch/sparc/mm/init.c
--- a/arch/sparc/mm/init.c Thu Aug 1 14:17:40 2002
+++ b/arch/sparc/mm/init.c Thu Aug 1 14:17:40 2002
@@ -18,7 +18,6 @@
#include
#include
#include
-#include
#ifdef CONFIG_BLK_DEV_INITRD
#include
#endif
diff -Nru a/arch/sparc64/kernel/sys_sparc32.c b/arch/sparc64/kernel/sys_sparc32.c
--- a/arch/sparc64/kernel/sys_sparc32.c Thu Aug 1 14:17:41 2002
+++ b/arch/sparc64/kernel/sys_sparc32.c Thu Aug 1 14:17:41 2002
@@ -3878,10 +3878,10 @@
}
-extern asmlinkage ssize_t sys_pread(unsigned int fd, char * buf,
+extern asmlinkage ssize_t sys_pread64(unsigned int fd, char * buf,
size_t count, loff_t pos);
-extern asmlinkage ssize_t sys_pwrite(unsigned int fd, const char * buf,
+extern asmlinkage ssize_t sys_pwrite64(unsigned int fd, const char * buf,
size_t count, loff_t pos);
typedef __kernel_ssize_t32 ssize_t32;
@@ -3889,13 +3889,13 @@
asmlinkage ssize_t32 sys32_pread(unsigned int fd, char *ubuf,
__kernel_size_t32 count, u32 poshi, u32 poslo)
{
- return sys_pread(fd, ubuf, count, ((loff_t)AA(poshi) << 32) | AA(poslo));
+ return sys_pread64(fd, ubuf, count, ((loff_t)AA(poshi) << 32) | AA(poslo));
}
asmlinkage ssize_t32 sys32_pwrite(unsigned int fd, char *ubuf,
__kernel_size_t32 count, u32 poshi, u32 poslo)
{
- return sys_pwrite(fd, ubuf, count, ((loff_t)AA(poshi) << 32) | AA(poslo));
+ return sys_pwrite64(fd, ubuf, count, ((loff_t)AA(poshi) << 32) | AA(poslo));
}
extern asmlinkage ssize_t sys_readahead(int fd, loff_t offset, size_t count);
diff -Nru a/arch/sparc64/kernel/systbls.S b/arch/sparc64/kernel/systbls.S
--- a/arch/sparc64/kernel/systbls.S Thu Aug 1 14:17:40 2002
+++ b/arch/sparc64/kernel/systbls.S Thu Aug 1 14:17:40 2002
@@ -32,7 +32,7 @@
/*50*/ .word sys32_getegid16, sys_acct, sys_nis_syscall, sys_getgid, sys32_ioctl
.word sys_reboot, sys32_mmap2, sys_symlink, sys_readlink, sys32_execve
/*60*/ .word sys_umask, sys_chroot, sys32_newfstat, sys_fstat64, sys_getpagesize
- .word sys_msync, sys_vfork, sys32_pread, sys32_pwrite, sys_geteuid
+ .word sys_msync, sys_vfork, sys32_pread64, sys32_pwrite64, sys_geteuid
/*70*/ .word sys_getegid, sys32_mmap, sys_setreuid, sys_munmap, sys_mprotect
.word sys_madvise, sys_vhangup, sys32_truncate64, sys_mincore, sys32_getgroups16
/*80*/ .word sys32_setgroups16, sys_getpgrp, sys_setgroups, sys32_setitimer, sys32_ftruncate64
diff -Nru a/arch/sparc64/mm/init.c b/arch/sparc64/mm/init.c
--- a/arch/sparc64/mm/init.c Thu Aug 1 14:17:40 2002
+++ b/arch/sparc64/mm/init.c Thu Aug 1 14:17:40 2002
@@ -15,7 +15,6 @@
#include
#include
#include
-#include
#include
#include
#include
diff -Nru a/arch/sparc64/solaris/socksys.c b/arch/sparc64/solaris/socksys.c
--- a/arch/sparc64/solaris/socksys.c Thu Aug 1 14:17:40 2002
+++ b/arch/sparc64/solaris/socksys.c Thu Aug 1 14:17:40 2002
@@ -181,7 +181,7 @@
int (*sys_close)(unsigned int) =
(int (*)(unsigned int))SYS(close);
- ret = devfs_register_chrdev (30, "socksys", &socksys_fops);
+ ret = register_chrdev (30, "socksys", &socksys_fops);
if (ret < 0) {
printk ("Couldn't register socksys character device\n");
return ret;
@@ -208,7 +208,7 @@
void
cleanup_socksys(void)
{
- if (devfs_unregister_chrdev(30, "socksys"))
+ if (unregister_chrdev(30, "socksys"))
printk ("Couldn't unregister socksys character device\n");
devfs_unregister (devfs_handle);
}
diff -Nru a/arch/x86_64/ia32/sys_ia32.c b/arch/x86_64/ia32/sys_ia32.c
--- a/arch/x86_64/ia32/sys_ia32.c Thu Aug 1 14:17:40 2002
+++ b/arch/x86_64/ia32/sys_ia32.c Thu Aug 1 14:17:40 2002
@@ -1948,10 +1948,10 @@
return ret;
}
-extern asmlinkage ssize_t sys_pread(unsigned int fd, char * buf,
+extern asmlinkage ssize_t sys_pread64(unsigned int fd, char * buf,
size_t count, loff_t pos);
-extern asmlinkage ssize_t sys_pwrite(unsigned int fd, const char * buf,
+extern asmlinkage ssize_t sys_pwrite64(unsigned int fd, const char * buf,
size_t count, loff_t pos);
typedef __kernel_ssize_t32 ssize_t32;
@@ -1961,7 +1961,7 @@
sys32_pread(unsigned int fd, char *ubuf, __kernel_size_t32 count,
u32 poslo, u32 poshi)
{
- return sys_pread(fd, ubuf, count,
+ return sys_pread64(fd, ubuf, count,
((loff_t)AA(poshi) << 32) | AA(poslo));
}
@@ -1969,7 +1969,7 @@
sys32_pwrite(unsigned int fd, char *ubuf, __kernel_size_t32 count,
u32 poslo, u32 poshi)
{
- return sys_pwrite(fd, ubuf, count,
+ return sys_pwrite64(fd, ubuf, count,
((loff_t)AA(poshi) << 32) | AA(poslo));
}
diff -Nru a/arch/x86_64/kernel/Makefile b/arch/x86_64/kernel/Makefile
--- a/arch/x86_64/kernel/Makefile Thu Aug 1 14:17:37 2002
+++ b/arch/x86_64/kernel/Makefile Thu Aug 1 14:17:37 2002
@@ -5,7 +5,7 @@
O_TARGET := kernel.o
EXTRA_TARGETS := head.o head64.o init_task.o
-export-objs := mtrr.o msr.o cpuid.o x8664_ksyms.o
+export-objs := mtrr.o x8664_ksyms.o
obj-y := process.o semaphore.o signal.o entry.o traps.o irq.o \
ptrace.o i8259.o ioport.o ldt.o setup.o time.o sys_x86_64.o \
diff -Nru a/drivers/Makefile b/drivers/Makefile
--- a/drivers/Makefile Thu Aug 1 14:17:41 2002
+++ b/drivers/Makefile Thu Aug 1 14:17:41 2002
@@ -7,8 +7,9 @@
obj-$(CONFIG_PCI) += pci/
obj-$(CONFIG_ACPI) += acpi/
+obj-y += serial/
obj-$(CONFIG_PARPORT) += parport/
-obj-y += base/ serial/ char/ block/ misc/ net/ media/
+obj-y += base/ char/ block/ misc/ net/ media/
obj-$(CONFIG_NUBUS) += nubus/
obj-$(CONFIG_ATM) += atm/
obj-$(CONFIG_IDE) += ide/
diff -Nru a/drivers/acorn/block/mfmhd.c b/drivers/acorn/block/mfmhd.c
--- a/drivers/acorn/block/mfmhd.c Thu Aug 1 14:17:37 2002
+++ b/drivers/acorn/block/mfmhd.c Thu Aug 1 14:17:37 2002
@@ -194,7 +194,6 @@
#define MFM_DRV_INFO mfm_info[raw_cmd.dev]
static struct hd_struct mfm[MFM_MAXDRIVES << 6];
-static int mfm_sizes[MFM_MAXDRIVES << 6];
/* Stuff from the assembly routines */
extern unsigned int hdc63463_baseaddress; /* Controller base address */
@@ -1254,12 +1253,20 @@
}
}
-static struct gendisk mfm_gendisk = {
+static struct gendisk mfm_gendisk[2] = {
+{
major: MAJOR_NR,
+ first_minor: 0,
major_name: "mfm",
minor_shift: 6,
part: mfm,
- sizes: mfm_sizes,
+},
+{
+ major: MAJOR_NR,
+ first_minor: 64,
+ major_name: "mfm",
+ minor_shift: 6,
+ part: mfm + 64,
};
static struct block_device_operations mfm_fops =
@@ -1277,8 +1284,6 @@
printk("mfm: detected %d hard drive%s\n", mfm_drives,
mfm_drives == 1 ? "" : "s");
- mfm_gendisk.nr_real = mfm_drives;
-
if (request_irq(mfm_irq, mfm_interrupt_handler, SA_INTERRUPT, "MFM harddisk", NULL))
printk("mfm: unable to get IRQ%d\n", mfm_irq);
@@ -1286,8 +1291,10 @@
outw(0x80, mfm_irqenable); /* Required to enable IRQs from MFM podule */
for (i = 0; i < mfm_drives; i++) {
+ mfm_gendisk[i].nr_real = 1;
+ add_gendisk(mfm_gendisk + i);
mfm_geometry (i);
- register_disk(&mfm_gendisk, mk_kdev(MAJOR_NR,i<<6), 1<<6,
+ register_disk(mfm_gendisk + i, mk_kdev(MAJOR_NR,i<<6), 1<<6,
&mfm_fops,
mfm_info[i].cylinders * mfm_info[i].heads *
mfm_info[i].sectors / 2);
@@ -1382,8 +1389,6 @@
blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), do_mfm_request);
- add_gendisk(&mfm_gendisk);
-
Busy = 0;
lastspecifieddrive = -1;
@@ -1421,11 +1426,13 @@
void cleanup_module(void)
{
+ int i;
if (ecs && mfm_irqenable)
outw (0, mfm_irqenable); /* Required to enable IRQs from MFM podule */
free_irq(mfm_irq, NULL);
unregister_blkdev(MAJOR_NR, "mfm");
- del_gendisk(&mfm_gendisk);
+ for (i = 0; i < mfm_drives; i++)
+ del_gendisk(mfm_gendisk + i);
if (ecs)
ecard_release(ecs);
if (mfm_addr)
diff -Nru a/drivers/acorn/char/Makefile b/drivers/acorn/char/Makefile
--- a/drivers/acorn/char/Makefile Thu Aug 1 14:17:36 2002
+++ b/drivers/acorn/char/Makefile Thu Aug 1 14:17:36 2002
@@ -3,8 +3,6 @@
#
# All the objects that export symbols.
-export-objs := mouse_rpc.o
-
obj-arc := keyb_arc.o
obj-rpc := keyb_ps2.o
obj-clps7500 := keyb_ps2.o defkeymap-acorn.o
diff -Nru a/drivers/base/base.h b/drivers/base/base.h
--- a/drivers/base/base.h Thu Aug 1 14:17:40 2002
+++ b/drivers/base/base.h Thu Aug 1 14:17:40 2002
@@ -17,6 +17,7 @@
extern void device_remove_dir(struct device * dev);
extern int device_bus_link(struct device * dev);
+extern void device_remove_symlink(struct driver_dir_entry * dir, const char * name);
extern int driver_attach(struct device_driver * drv);
extern void driver_detach(struct device_driver * drv);
diff -Nru a/drivers/base/bus.c b/drivers/base/bus.c
--- a/drivers/base/bus.c Thu Aug 1 14:17:39 2002
+++ b/drivers/base/bus.c Thu Aug 1 14:17:39 2002
@@ -140,7 +140,7 @@
void bus_remove_device(struct device * dev)
{
if (dev->bus) {
- driverfs_remove_file(&dev->bus->device_dir,dev->bus_id);
+ device_remove_symlink(&dev->bus->device_dir,dev->bus_id);
write_lock(&dev->bus->lock);
list_del_init(&dev->bus_list);
write_unlock(&dev->bus->lock);
diff -Nru a/drivers/base/fs.c b/drivers/base/fs.c
--- a/drivers/base/fs.c Thu Aug 1 14:17:40 2002
+++ b/drivers/base/fs.c Thu Aug 1 14:17:40 2002
@@ -15,7 +15,63 @@
#include
#include
-extern struct driver_file_entry * device_default_files[];
+extern struct device_attribute * device_default_files[];
+
+#define to_dev_attr(_attr) container_of(_attr,struct device_attribute,attr)
+
+#define to_device(d) container_of(d, struct device, dir)
+
+
+/* driverfs ops for device attribute files */
+
+static int
+dev_attr_open(struct driver_dir_entry * dir)
+{
+ struct device * dev = to_device(dir);
+ get_device(dev);
+ return 0;
+}
+
+static int
+dev_attr_close(struct driver_dir_entry * dir)
+{
+ struct device * dev = to_device(dir);
+ put_device(dev);
+ return 0;
+}
+
+static ssize_t
+dev_attr_show(struct driver_dir_entry * dir, struct attribute * attr,
+ char * buf, size_t count, loff_t off)
+{
+ struct device_attribute * dev_attr = to_dev_attr(attr);
+ struct device * dev = to_device(dir);
+ ssize_t ret = 0;
+
+ if (dev_attr->show)
+ ret = dev_attr->show(dev,buf,count,off);
+ return ret;
+}
+
+static ssize_t
+dev_attr_store(struct driver_dir_entry * dir, struct attribute * attr,
+ const char * buf, size_t count, loff_t off)
+{
+ struct device_attribute * dev_attr = to_dev_attr(attr);
+ struct device * dev = to_device(dir);
+ ssize_t ret = 0;
+
+ if (dev_attr->store)
+ ret = dev_attr->store(dev,buf,count,off);
+ return ret;
+}
+
+static struct driverfs_ops dev_attr_ops = {
+ open: dev_attr_open,
+ close: dev_attr_close,
+ show: dev_attr_show,
+ store: dev_attr_store,
+};
/**
* device_create_file - create a driverfs file for a device
@@ -24,25 +80,15 @@
*
* Allocate space for file entry, copy descriptor, and create.
*/
-int device_create_file(struct device * dev, struct driver_file_entry * entry)
+int device_create_file(struct device * dev, struct device_attribute * entry)
{
- struct driver_file_entry * new_entry;
- int error = -ENOMEM;
-
- if (!dev)
- return -EINVAL;
- get_device(dev);
+ int error = -EINVAL;
- new_entry = kmalloc(sizeof(*new_entry),GFP_KERNEL);
- if (!new_entry)
- goto done;
-
- memcpy(new_entry,entry,sizeof(*entry));
- error = driverfs_create_file(new_entry,&dev->dir);
- if (error)
- kfree(new_entry);
- done:
- put_device(dev);
+ if (dev) {
+ get_device(dev);
+ error = driverfs_create_file(&entry->attr,&dev->dir);
+ put_device(dev);
+ }
return error;
}
@@ -52,11 +98,11 @@
* @name: name of the file
*
*/
-void device_remove_file(struct device * dev, const char * name)
+void device_remove_file(struct device * dev, struct device_attribute * attr)
{
if (dev) {
get_device(dev);
- driverfs_remove_file(&dev->dir,name);
+ driverfs_remove_file(&dev->dir,attr->attr.name);
put_device(dev);
}
}
@@ -71,7 +117,6 @@
driverfs_remove_dir(&dev->dir);
}
-
static int get_devpath_length(struct device * dev)
{
int length = 1;
@@ -103,22 +148,6 @@
pr_debug("%s: path = '%s'\n",__FUNCTION__,path);
}
-static int create_symlink(struct driver_dir_entry * parent, char * name, char * path)
-{
- struct driver_file_entry * entry;
- int error;
-
- entry = kmalloc(sizeof(struct driver_file_entry),GFP_KERNEL);
- if (!entry)
- return -ENOMEM;
- entry->name = name;
- entry->mode = S_IRUGO;
- error = driverfs_create_symlink(parent,entry,path);
- if (error)
- kfree(entry);
- return error;
-}
-
int device_bus_link(struct device * dev)
{
char * path;
@@ -148,15 +177,18 @@
strcpy(path,"../../..");
fill_devpath(dev,path,length);
- error = create_symlink(&dev->bus->device_dir,dev->bus_id,path);
-
+ error = driverfs_create_symlink(&dev->bus->device_dir,dev->bus_id,path);
kfree(path);
return error;
}
+void device_remove_symlink(struct driver_dir_entry * dir, const char * name)
+{
+ driverfs_remove_file(dir,name);
+}
+
int device_create_dir(struct driver_dir_entry * dir, struct driver_dir_entry * parent)
{
- INIT_LIST_HEAD(&dir->files);
dir->mode = (S_IFDIR| S_IRWXU | S_IRUGO | S_IXUGO);
return driverfs_create_dir(dir,parent);
}
@@ -176,13 +208,14 @@
int device_make_dir(struct device * dev)
{
struct driver_dir_entry * parent = NULL;
- struct driver_file_entry * entry;
+ struct device_attribute * entry;
int error;
int i;
if (dev->parent)
parent = &dev->parent->dir;
dev->dir.name = dev->bus_id;
+ dev->dir.ops = &dev_attr_ops;
if ((error = device_create_dir(&dev->dir,parent)))
return error;
diff -Nru a/drivers/base/interface.c b/drivers/base/interface.c
--- a/drivers/base/interface.c Thu Aug 1 14:17:36 2002
+++ b/drivers/base/interface.c Thu Aug 1 14:17:36 2002
@@ -14,11 +14,7 @@
return off ? 0 : sprintf(buf,"%s\n",dev->name);
}
-static struct driver_file_entry device_name_entry = {
- name: "name",
- mode: S_IRUGO,
- show: device_read_name,
-};
+static DEVICE_ATTR(name,"name",S_IRUGO,device_read_name,NULL);
static ssize_t
device_read_power(struct device * dev, char * page, size_t count, loff_t off)
@@ -89,15 +85,11 @@
return error < 0 ? error : count;
}
-static struct driver_file_entry device_power_entry = {
- name: "power",
- mode: S_IWUSR | S_IRUGO,
- show: device_read_power,
- store: device_write_power,
-};
-
-struct driver_file_entry * device_default_files[] = {
- &device_name_entry,
- &device_power_entry,
+static DEVICE_ATTR(power,"power",S_IWUSR | S_IRUGO,
+ device_read_power,device_write_power);
+
+struct device_attribute * device_default_files[] = {
+ &dev_attr_name,
+ &dev_attr_power,
NULL,
};
diff -Nru a/drivers/block/DAC960.c b/drivers/block/DAC960.c
--- a/drivers/block/DAC960.c Thu Aug 1 14:17:41 2002
+++ b/drivers/block/DAC960.c Thu Aug 1 14:17:41 2002
@@ -1934,7 +1934,7 @@
/*
Register the Block Device Major Number for this DAC960 Controller.
*/
- if (devfs_register_blkdev(MajorNumber, "dac960",
+ if (register_blkdev(MajorNumber, "dac960",
&DAC960_BlockDeviceOperations) < 0)
{
DAC960_Error("UNABLE TO ACQUIRE MAJOR NUMBER %d - DETACHING\n",
@@ -1961,7 +1961,6 @@
Controller->MaxSectorsPerRequest[MinorNumber] =
Controller->MaxBlocksPerCommand;
Controller->GenericDiskInfo.part = Controller->DiskPartitions;
- Controller->GenericDiskInfo.sizes = Controller->PartitionSizes;
/*
Complete initialization of the Generic Disk Information structure.
*/
@@ -1993,7 +1992,7 @@
/*
Unregister the Block Device Major Number for this DAC960 Controller.
*/
- devfs_unregister_blkdev(MajorNumber, "dac960");
+ unregister_blkdev(MajorNumber, "dac960");
/*
Remove the I/O Request Queue.
*/
@@ -2003,7 +2002,6 @@
array, Max Sectors per Request array, and Max Segments per Request array.
*/
Controller->GenericDiskInfo.part = NULL;
- Controller->GenericDiskInfo.sizes = NULL;
blk_clear(MajorNumber);
/*
Remove the Generic Disk Information structure from the list.
@@ -5295,7 +5293,7 @@
DAC960_ComputeGenericDiskInfo(Controller);
DAC960_RegisterDisk(Controller, LogicalDriveNumber);
}
- if (Controller->GenericDiskInfo.sizes[minor(Inode->i_rdev)] == 0)
+ if (Controller->GenericDiskInfo.part[minor(Inode->i_rdev)].nr_sects == 0)
return -ENXIO;
/*
Increment Controller and Logical Drive Usage Counts.
diff -Nru a/drivers/block/DAC960.h b/drivers/block/DAC960.h
--- a/drivers/block/DAC960.h Thu Aug 1 14:17:41 2002
+++ b/drivers/block/DAC960.h Thu Aug 1 14:17:41 2002
@@ -2473,7 +2473,6 @@
} V2;
} FW;
DiskPartition_T DiskPartitions[DAC960_MinorCount];
- int PartitionSizes[DAC960_MinorCount];
unsigned char ProgressBuffer[DAC960_ProgressBufferSize];
unsigned char UserStatusBuffer[DAC960_UserMessageSize];
}
diff -Nru a/drivers/block/Makefile b/drivers/block/Makefile
--- a/drivers/block/Makefile Thu Aug 1 14:17:41 2002
+++ b/drivers/block/Makefile Thu Aug 1 14:17:41 2002
@@ -8,7 +8,8 @@
# In the future, some of these should be built conditionally.
#
-export-objs := elevator.o ll_rw_blk.o blkpg.o loop.o DAC960.o genhd.o block_ioctl.o
+export-objs := elevator.o ll_rw_blk.o blkpg.o loop.o genhd.o \
+ block_ioctl.o acsi.o
obj-y := elevator.o ll_rw_blk.o blkpg.o genhd.o block_ioctl.o
diff -Nru a/drivers/block/acsi.c b/drivers/block/acsi.c
--- a/drivers/block/acsi.c Thu Aug 1 14:17:40 2002
+++ b/drivers/block/acsi.c Thu Aug 1 14:17:40 2002
@@ -56,7 +56,6 @@
#include
#include
#include
-#include
#include
#include
#include
@@ -246,7 +245,6 @@
unsigned long phys_acsi_buffer;
static int NDevices = 0;
-static int acsi_sizes[MAX_DEV<<4] = { 0, };
static struct hd_struct acsi_part[MAX_DEV<<4] = { {0,0}, };
static int access_count[MAX_DEV] = { 0, };
@@ -1360,7 +1358,6 @@
major_name: "ad",
minor_shift: 4,
part: acsi_part,
- sizes: acsi_sizes,
fops: &acsi_fops,
};
@@ -1741,14 +1738,14 @@
int err = 0;
if (!MACH_IS_ATARI || !ATARIHW_PRESENT(ACSI))
return 0;
- if (devfs_register_blkdev( MAJOR_NR, "ad", &acsi_fops )) {
+ if (register_blkdev( MAJOR_NR, "ad", &acsi_fops )) {
printk( KERN_ERR "Unable to get major %d for ACSI\n", MAJOR_NR );
return -EBUSY;
}
if (!(acsi_buffer =
(char *)atari_stram_alloc(ACSI_BUFFER_SIZE, "acsi"))) {
printk( KERN_ERR "Unable to get ACSI ST-Ram buffer.\n" );
- devfs_unregister_blkdev( MAJOR_NR, "ad" );
+ unregister_blkdev( MAJOR_NR, "ad" );
return -ENOMEM;
}
phys_acsi_buffer = virt_to_phys( acsi_buffer );
@@ -1786,7 +1783,7 @@
blk_cleanup_queue(BLK_DEFAULT_QUEUE(MAJOR_NR));
atari_stram_free( acsi_buffer );
- if (devfs_unregister_blkdev( MAJOR_NR, "ad" ) != 0)
+ if (unregister_blkdev( MAJOR_NR, "ad" ) != 0)
printk( KERN_ERR "acsi: cleanup_module failed\n");
del_gendisk(&acsi_gendisk);
diff -Nru a/drivers/block/acsi_slm.c b/drivers/block/acsi_slm.c
--- a/drivers/block/acsi_slm.c Thu Aug 1 14:17:36 2002
+++ b/drivers/block/acsi_slm.c Thu Aug 1 14:17:36 2002
@@ -998,14 +998,14 @@
int slm_init( void )
{
- if (devfs_register_chrdev( MAJOR_NR, "slm", &slm_fops )) {
+ if (register_chrdev( MAJOR_NR, "slm", &slm_fops )) {
printk( KERN_ERR "Unable to get major %d for ACSI SLM\n", MAJOR_NR );
return -EBUSY;
}
if (!(SLMBuffer = atari_stram_alloc( SLM_BUFFER_SIZE, NULL, "SLM" ))) {
printk( KERN_ERR "Unable to get SLM ST-Ram buffer.\n" );
- devfs_unregister_chrdev( MAJOR_NR, "slm" );
+ unregister_chrdev( MAJOR_NR, "slm" );
return -ENOMEM;
}
BufferP = SLMBuffer;
@@ -1038,7 +1038,7 @@
void cleanup_module(void)
{
devfs_unregister (devfs_handle);
- if (devfs_unregister_chrdev( MAJOR_NR, "slm" ) != 0)
+ if (unregister_chrdev( MAJOR_NR, "slm" ) != 0)
printk( KERN_ERR "acsi_slm: cleanup_module failed\n");
atari_stram_free( SLMBuffer );
}
diff -Nru a/drivers/block/blkpg.c b/drivers/block/blkpg.c
--- a/drivers/block/blkpg.c Thu Aug 1 14:17:36 2002
+++ b/drivers/block/blkpg.c Thu Aug 1 14:17:36 2002
@@ -86,7 +86,7 @@
g = get_gendisk(dev);
if (!g)
return -ENXIO;
- part = g->part + minor(dev);
+ part = g->part + minor(dev) - g->first_minor;
/* existing drive? */
@@ -109,8 +109,6 @@
/* all seems OK */
part[p->pno].start_sect = pstart;
part[p->pno].nr_sects = plength;
- if (g->sizes)
- g->sizes[minor(dev)+p->pno] = (plength >> (BLOCK_SIZE_BITS-9));
devfs_register_partitions (g, minor(dev), 0);
return 0;
}
@@ -137,7 +135,7 @@
g = get_gendisk(dev);
if (!g)
return -ENXIO;
- part = g->part + minor(dev);
+ part = g->part + minor(dev) - g->first_minor;
if (bdev != bdev->bd_contains)
return -EINVAL;
@@ -163,8 +161,6 @@
part[p->pno].start_sect = 0;
part[p->pno].nr_sects = 0;
- if (g->sizes)
- g->sizes[minor(dev) + p->pno] = 0;
devfs_register_partitions (g, minor(dev), 0);
bd_release(bdevp);
bdput(bdevp);
diff -Nru a/drivers/block/cciss.c b/drivers/block/cciss.c
--- a/drivers/block/cciss.c Thu Aug 1 14:17:41 2002
+++ b/drivers/block/cciss.c Thu Aug 1 14:17:41 2002
@@ -348,8 +348,7 @@
drv = &(hba[ctlr]->drv[i]);
if( !(drv->nr_blocks))
continue;
- hba[ctlr]->hd[i << NWD_SHIFT].nr_sects =
- hba[ctlr]->sizes[i << NWD_SHIFT] = drv->nr_blocks;
+ hba[ctlr]->hd[i << NWD_SHIFT].nr_sects = drv->nr_blocks;
//hba[ctlr]->gendisk.nr_real++;
(BLK_DEFAULT_QUEUE(MAJOR_NR + ctlr))->hardsect_size = drv->block_size;
}
@@ -375,7 +374,7 @@
* but I'm already using way to many device nodes to claim another one
* for "raw controller".
*/
- if (hba[ctlr]->sizes[minor(inode->i_rdev)] == 0) {
+ if (inode->i_bdev->bd_inode->i_size == 0) {
if (minor(inode->i_rdev) != 0)
return -ENXIO;
if (!capable(CAP_SYS_ADMIN))
@@ -806,7 +805,6 @@
* on this controller to zero. We will reread all of this data
*/
memset(hba[ctlr]->hd, 0, sizeof(struct hd_struct) * 256);
- memset(hba[ctlr]->sizes, 0, sizeof(int) * 256);
memset(hba[ctlr]->drv, 0, sizeof(drive_info_struct)
* CISS_MAX_LUN);
hba[ctlr]->gendisk.nr_real = 0;
@@ -823,7 +821,7 @@
cciss_geninit(ctlr);
for(i=0; isizes[ i<gendisk.part[ i<gendisk);
ctlr_info_t *h = hba[ctlr];
- int start, max_p, i;
+ int start, max_p;
if (!capable(CAP_SYS_RAWIO))
@@ -856,8 +854,6 @@
max_p = 1 << gdev->minor_shift;
start = logvol << gdev->minor_shift;
wipe_partitions(mk_kdev(MAJOR_NR+ctlr, start));
- for (i=max_p-1; i>=0; i--)
- h->sizes[start + i] = 0;
/* check to see if it was the last disk */
if (logvol == h->highest_lun)
{
@@ -866,7 +862,7 @@
for(i=0; ihighest_lun; i++)
{
/* if the disk has size > 0, it is available */
- if (h->sizes[i << gdev->minor_shift] != 0)
+ if (h->gendisk.part[i << gdev->minor_shift].nr_sects)
newhighest = i;
}
h->highest_lun = newhighest;
@@ -2498,7 +2494,6 @@
hba[i]->gendisk.major_name = "cciss";
hba[i]->gendisk.minor_shift = NWD_SHIFT;
hba[i]->gendisk.part = hba[i]->hd;
- hba[i]->gendisk.sizes = hba[i]->sizes;
hba[i]->gendisk.nr_real = hba[i]->highest_lun+1;
/* Get on the disk list */
diff -Nru a/drivers/block/cpqarray.c b/drivers/block/cpqarray.c
--- a/drivers/block/cpqarray.c Thu Aug 1 14:17:36 2002
+++ b/drivers/block/cpqarray.c Thu Aug 1 14:17:36 2002
@@ -104,7 +104,6 @@
};
static struct hd_struct * ida;
-static int * ida_sizes;
static struct gendisk ida_gendisk[MAX_CTLR];
static struct proc_dir_entry *proc_array;
@@ -176,9 +175,7 @@
drv = &hba[ctlr]->drv[i];
if (!drv->nr_blks)
continue;
- ida[(ctlr<nr_blks;
+ ida[(ctlr<nr_blks;
(BLK_DEFAULT_QUEUE(MAJOR_NR + ctlr))->hardsect_size = drv->blk_size;
ida_gendisk[ctlr].nr_real++;
@@ -336,10 +333,9 @@
del_gendisk(&ida_gendisk[i]);
}
- devfs_unregister(devfs_find_handle(NULL, "ida", 0, 0, 0, 0));
+ devfs_find_and_unregister(NULL, "ida", 0, 0, 0, 0);
remove_proc_entry("cpqarray", proc_root_driver);
kfree(ida);
- kfree(ida_sizes);
}
#endif /* MODULE */
@@ -372,16 +368,7 @@
return(num_cntlrs_reg);
}
- ida_sizes = kmalloc(sizeof(int)*nr_ctlr*NWD*16, GFP_KERNEL);
- if(ida_sizes==NULL)
- {
- kfree(ida);
- printk( KERN_ERR "cpqarray: out of memory");
- return(num_cntlrs_reg);
- }
-
memset(ida, 0, sizeof(struct hd_struct)*nr_ctlr*NWD*16);
- memset(ida_sizes, 0, sizeof(int)*nr_ctlr*NWD*16);
memset(ida_gendisk, 0, sizeof(struct gendisk)*MAX_CTLR);
/*
@@ -437,7 +424,6 @@
if (num_cntlrs_reg == 0)
{
kfree(ida);
- kfree(ida_sizes);
}
return(num_cntlrs_reg);
@@ -469,7 +455,6 @@
ida_gendisk[i].major_name = "ida";
ida_gendisk[i].minor_shift = NWD_SHIFT;
ida_gendisk[i].part = ida + (i*256);
- ida_gendisk[i].sizes = ida_sizes + (i*256);
ida_gendisk[i].nr_real = 0;
ida_gendisk[i].de_arr = de_arr[i];
ida_gendisk[i].fops = &ida_fops;
@@ -770,8 +755,7 @@
if (ctlr > MAX_CTLR || hba[ctlr] == NULL)
return -ENXIO;
- if (!capable(CAP_SYS_RAWIO) && ida_sizes[(ctlr << CTLR_SHIFT) +
- minor(inode->i_rdev)] == 0)
+ if (!capable(CAP_SYS_RAWIO) && inode->i_bdev->bd_inode->i_size == 0)
return -ENXIO;
/*
@@ -781,7 +765,7 @@
* for "raw controller".
*/
if (capable(CAP_SYS_ADMIN)
- && ida_sizes[(ctlr << CTLR_SHIFT) + minor(inode->i_rdev)] == 0
+ && inode->i_bdev->bd_inode->i_size == 0
&& minor(inode->i_rdev) != 0)
return -ENXIO;
@@ -1498,7 +1482,6 @@
* on this controller to zero. We will reread all of this data
*/
memset(ida+(ctlr*256), 0, sizeof(struct hd_struct)*NWD*16);
- memset(ida_sizes+(ctlr*256), 0, sizeof(int)*NWD*16);
memset(hba[ctlr]->drv, 0, sizeof(drv_info_t)*NWD);
ida_gendisk[ctlr].nr_real = 0;
@@ -1514,7 +1497,7 @@
ida_geninit(ctlr);
for(i=0; ielevator;
int lat = 0, *latency = e->elevator_data;
+ if (!insert_here)
+ insert_here = q->queue_head.prev;
+
if (!(rq->flags & REQ_BARRIER))
lat = latency[rq_data_dir(rq)];
@@ -318,7 +322,7 @@
struct request *elevator_noop_next_request(request_queue_t *q)
{
- if (!blk_queue_empty(q))
+ if (!list_empty(&q->queue_head))
return list_entry_rq(q->queue_head.next);
return NULL;
@@ -376,7 +380,7 @@
elevator_t *e = &q->elevator;
if (e->elevator_merge_req_fn)
- e->elevator_merge_req_fn(rq, next);
+ e->elevator_merge_req_fn(q, rq, next);
}
/*
@@ -431,6 +435,27 @@
if (e->elevator_remove_req_fn)
e->elevator_remove_req_fn(q, rq);
+}
+
+int elv_queue_empty(request_queue_t *q)
+{
+ elevator_t *e = &q->elevator;
+
+ if (e->elevator_queue_empty_fn)
+ return e->elevator_queue_empty_fn(q);
+
+ return list_empty(&q->queue_head);
+}
+
+inline struct list_head *elv_get_sort_head(request_queue_t *q,
+ struct request *rq)
+{
+ elevator_t *e = &q->elevator;
+
+ if (e->elevator_get_sort_head_fn)
+ return e->elevator_get_sort_head_fn(q, rq);
+
+ return &q->queue_head;
}
elevator_t elevator_linus = {
diff -Nru a/drivers/block/floppy.c b/drivers/block/floppy.c
--- a/drivers/block/floppy.c Thu Aug 1 14:17:36 2002
+++ b/drivers/block/floppy.c Thu Aug 1 14:17:36 2002
@@ -4233,7 +4233,7 @@
raw_cmd = NULL;
devfs_handle = devfs_mk_dir (NULL, "floppy", NULL);
- if (devfs_register_blkdev(MAJOR_NR,"fd",&floppy_fops)) {
+ if (register_blkdev(MAJOR_NR,"fd",&floppy_fops)) {
printk("Unable to get major %d for floppy\n",MAJOR_NR);
return -EBUSY;
}
@@ -4266,7 +4266,7 @@
use_virtual_dma = can_use_virtual_dma & 1;
fdc_state[0].address = FDC1;
if (fdc_state[0].address == -1) {
- devfs_unregister_blkdev(MAJOR_NR,"fd");
+ unregister_blkdev(MAJOR_NR,"fd");
del_timer(&fd_timeout);
blk_cleanup_queue(BLK_DEFAULT_QUEUE(MAJOR_NR));
return -ENODEV;
@@ -4279,7 +4279,7 @@
if (floppy_grab_irq_and_dma()){
del_timer(&fd_timeout);
blk_cleanup_queue(BLK_DEFAULT_QUEUE(MAJOR_NR));
- devfs_unregister_blkdev(MAJOR_NR,"fd");
+ unregister_blkdev(MAJOR_NR,"fd");
return -EBUSY;
}
@@ -4342,7 +4342,7 @@
if (usage_count)
floppy_release_irq_and_dma();
blk_cleanup_queue(BLK_DEFAULT_QUEUE(MAJOR_NR));
- devfs_unregister_blkdev(MAJOR_NR,"fd");
+ unregister_blkdev(MAJOR_NR,"fd");
}
for (drive = 0; drive < N_DRIVE; drive++) {
@@ -4539,7 +4539,7 @@
int dummy;
devfs_unregister (devfs_handle);
- devfs_unregister_blkdev(MAJOR_NR, "fd");
+ unregister_blkdev(MAJOR_NR, "fd");
blk_cleanup_queue(BLK_DEFAULT_QUEUE(MAJOR_NR));
/* eject disk, if any */
diff -Nru a/drivers/block/genhd.c b/drivers/block/genhd.c
--- a/drivers/block/genhd.c Thu Aug 1 14:17:40 2002
+++ b/drivers/block/genhd.c Thu Aug 1 14:17:40 2002
@@ -55,8 +55,8 @@
{
if (sgp == gp)
{
-// printk(KERN_ERR "add_gendisk: device major %d is buggy and added a live gendisk!\n",
-// sgp->major)
+ printk(KERN_ERR "add_gendisk: device major %d is buggy and added a live gendisk!\n",
+ sgp->major);
goto out;
}
}
@@ -104,15 +104,22 @@
get_gendisk(kdev_t dev)
{
struct gendisk *gp = NULL;
- int maj = major(dev);
+ int major = major(dev);
+ int minor = minor(dev);
read_lock(&gendisk_lock);
- for (gp = gendisk_head; gp; gp = gp->next)
- if (gp->major == maj)
- break;
+ for (gp = gendisk_head; gp; gp = gp->next) {
+ if (gp->major != major)
+ continue;
+ if (gp->first_minor > minor)
+ continue;
+ if (gp->first_minor + (1<minor_shift) <= minor)
+ continue;
+ read_unlock(&gendisk_lock);
+ return gp;
+ }
read_unlock(&gendisk_lock);
-
- return gp;
+ return NULL;
}
EXPORT_SYMBOL(get_gendisk);
@@ -157,9 +164,10 @@
int minormask = (1<minor_shift) - 1;
if ((n & minormask) && sgp->part[n].nr_sects == 0)
continue;
- seq_printf(part, "%4d %4d %10d %s\n",
- sgp->major, n, sgp->sizes[n],
- disk_name(sgp, n, buf));
+ seq_printf(part, "%4d %4d %10ld %s\n",
+ sgp->major, n + sgp->first_minor,
+ sgp->part[n].nr_sects << 1,
+ disk_name(sgp, n + sgp->first_minor, buf));
}
return 0;
diff -Nru a/drivers/block/ll_rw_blk.c b/drivers/block/ll_rw_blk.c
--- a/drivers/block/ll_rw_blk.c Thu Aug 1 14:17:36 2002
+++ b/drivers/block/ll_rw_blk.c Thu Aug 1 14:17:36 2002
@@ -1253,7 +1253,7 @@
* host that is unable to accept a particular command.
*/
void blk_insert_request(request_queue_t *q, struct request *rq,
- int at_head, void *data)
+ int at_head, void *data)
{
unsigned long flags;
@@ -1262,15 +1262,18 @@
* must not attempt merges on this) and that it acts as a soft
* barrier
*/
- rq->flags &= REQ_QUEUED;
rq->flags |= REQ_SPECIAL | REQ_BARRIER;
rq->special = data;
spin_lock_irqsave(q->queue_lock, flags);
- /* If command is tagged, release the tag */
- if(blk_rq_tagged(rq))
+
+ /*
+ * If command is tagged, release the tag
+ */
+ if (blk_rq_tagged(rq))
blk_queue_end_tag(q, rq);
+
_elv_add_request(q, rq, !at_head, 0);
q->request_fn(q);
spin_unlock_irqrestore(q->queue_lock, flags);
@@ -1388,7 +1391,6 @@
if (rq_data_dir(req) != rq_data_dir(next)
|| !kdev_same(req->rq_dev, next->rq_dev)
- || req->nr_sectors + next->nr_sectors > q->max_sectors
|| next->waiting || next->special)
return;
@@ -1399,15 +1401,14 @@
* counts here.
*/
if (q->merge_requests_fn(q, req, next)) {
- elv_merge_requests(q, req, next);
-
- blkdev_dequeue_request(next);
-
req->biotail->bi_next = next->bio;
req->biotail = next->biotail;
req->nr_sectors = req->hard_nr_sectors += next->hard_nr_sectors;
+ elv_merge_requests(q, req, next);
+
+ blkdev_dequeue_request(next);
blk_put_request(next);
}
}
@@ -1415,16 +1416,18 @@
static inline void attempt_back_merge(request_queue_t *q, struct request *rq)
{
struct list_head *next = rq->queuelist.next;
+ struct list_head *sort_head = elv_get_sort_head(q, rq);
- if (next != &q->queue_head)
+ if (next != sort_head)
attempt_merge(q, rq, list_entry_rq(next));
}
static inline void attempt_front_merge(request_queue_t *q, struct request *rq)
{
struct list_head *prev = rq->queuelist.prev;
+ struct list_head *sort_head = elv_get_sort_head(q, rq);
- if (prev != &q->queue_head)
+ if (prev != sort_head)
attempt_merge(q, list_entry_rq(prev), rq);
}
@@ -1484,7 +1487,7 @@
spin_lock_irq(q->queue_lock);
again:
req = NULL;
- insert_here = q->queue_head.prev;
+ insert_here = NULL;
if (blk_queue_empty(q)) {
blk_plug_device(q);
@@ -1502,11 +1505,10 @@
break;
}
- elv_merge_cleanup(q, req, nr_sectors);
-
req->biotail->bi_next = bio;
req->biotail = bio;
req->nr_sectors = req->hard_nr_sectors += nr_sectors;
+ elv_merge_cleanup(q, req, nr_sectors);
drive_stat_acct(req, nr_sectors, 0);
attempt_back_merge(q, req);
goto out;
@@ -1518,8 +1520,6 @@
break;
}
- elv_merge_cleanup(q, req, nr_sectors);
-
bio->bi_next = req->bio;
req->bio = bio;
/*
@@ -1532,6 +1532,7 @@
req->hard_cur_sectors = cur_nr_sectors;
req->sector = req->hard_sector = sector;
req->nr_sectors = req->hard_nr_sectors += nr_sectors;
+ elv_merge_cleanup(q, req, nr_sectors);
drive_stat_acct(req, nr_sectors, 0);
attempt_front_merge(q, req);
goto out;
@@ -1600,9 +1601,7 @@
req->buffer = bio_data(bio); /* see ->buffer comment above */
req->waiting = NULL;
req->bio = req->biotail = bio;
- if (bio->bi_bdev)
- req->rq_dev = to_kdev_t(bio->bi_bdev->bd_dev);
- else req->rq_dev = NODEV;
+ req->rq_dev = to_kdev_t(bio->bi_bdev->bd_dev);
add_request(q, req, insert_here);
out:
if (freereq)
diff -Nru a/drivers/block/loop.c b/drivers/block/loop.c
--- a/drivers/block/loop.c Thu Aug 1 14:17:36 2002
+++ b/drivers/block/loop.c Thu Aug 1 14:17:36 2002
@@ -1027,7 +1027,7 @@
max_loop = 8;
}
- if (devfs_register_blkdev(MAJOR_NR, "loop", &lo_fops)) {
+ if (register_blkdev(MAJOR_NR, "loop", &lo_fops)) {
printk(KERN_WARNING "Unable to get major number %d for loop"
" device\n", MAJOR_NR);
return -EIO;
@@ -1078,7 +1078,7 @@
void loop_exit(void)
{
devfs_unregister(devfs_handle);
- if (devfs_unregister_blkdev(MAJOR_NR, "loop"))
+ if (unregister_blkdev(MAJOR_NR, "loop"))
printk(KERN_WARNING "loop: cannot unregister blkdev\n");
kfree(loop_dev);
diff -Nru a/drivers/block/paride/pd.c b/drivers/block/paride/pd.c
--- a/drivers/block/paride/pd.c Thu Aug 1 14:17:41 2002
+++ b/drivers/block/paride/pd.c Thu Aug 1 14:17:41 2002
@@ -272,7 +272,6 @@
static void pd_eject( int unit);
static struct hd_struct pd_hd[PD_DEVS];
-static int pd_sizes[PD_DEVS];
#define PD_NAMELEN 8
@@ -292,6 +291,7 @@
int alt_geom;
int present;
char name[PD_NAMELEN]; /* pda, pdb, etc ... */
+ struct gendisk gd;
};
struct pd_unit pd[PD_UNITS];
@@ -331,9 +331,8 @@
major: PD_MAJOR,
major_name: PD_NAME,
minor_shift: PD_BITS,
- part: pd_hd,
- sizes: pd_sizes,
fops: &pd_fops,
+ nr_real: 1,
};
static struct block_device_operations pd_fops = {
@@ -682,8 +681,8 @@
}
static int pd_detect( void )
-
-{ int k, unit;
+{
+ int k, unit;
k = 0;
if (pd_drive_count == 0) { /* nothing spec'd - so autoprobe for 1 */
@@ -705,18 +704,19 @@
k = unit+1;
} else pi_release(PI);
}
- for (unit=0;unit
#include
#include
-#include
#include
#include
#include
@@ -111,7 +110,6 @@
static DECLARE_WAIT_QUEUE_HEAD(ps2esdi_int);
static int no_int_yet;
-static int ps2esdi_sizes[MAX_HD << 6];
static int ps2esdi_drives;
static struct hd_struct ps2esdi[MAX_HD << 6];
static u_short io_base;
@@ -156,7 +154,6 @@
major_name: "ed",
minor_shift: 6,
part: ps2esdi,
- sizes: ps2esdi_sizes,
fops: &ps2esdi_fops,
};
@@ -168,7 +165,7 @@
/* register the device - pass the name, major number and operations
vector . */
- if (devfs_register_blkdev(MAJOR_NR, "ed", &ps2esdi_fops)) {
+ if (register_blkdev(MAJOR_NR, "ed", &ps2esdi_fops)) {
printk("%s: Unable to get major number %d\n", DEVICE_NAME, MAJOR_NR);
return -1;
}
@@ -182,7 +179,7 @@
if (error) {
printk(KERN_WARNING "PS2ESDI: error initialising"
" device, releasing resources\n");
- devfs_unregister_blkdev(MAJOR_NR, "ed");
+ unregister_blkdev(MAJOR_NR, "ed");
blk_cleanup_queue(BLK_DEFAULT_QUEUE(MAJOR_NR));
del_gendisk(&ps2esdi_gendisk);
blk_clear(MAJOR_NR);
@@ -233,7 +230,7 @@
release_region(io_base, 4);
free_dma(dma_arb_level);
free_irq(PS2ESDI_IRQ, &ps2esdi_gendisk);
- devfs_unregister_blkdev(MAJOR_NR, "ed");
+ unregister_blkdev(MAJOR_NR, "ed");
blk_cleanup_queue(BLK_DEFAULT_QUEUE(MAJOR_NR));
del_gendisk(&ps2esdi_gendisk);
blk_clear(MAJOR_NR);
diff -Nru a/drivers/block/rd.c b/drivers/block/rd.c
--- a/drivers/block/rd.c Thu Aug 1 14:17:41 2002
+++ b/drivers/block/rd.c Thu Aug 1 14:17:41 2002
@@ -379,6 +379,7 @@
rd_bdev[unit]->bd_openers++;
rd_bdev[unit]->bd_block_size = rd_blocksize;
rd_bdev[unit]->bd_inode->i_mapping->a_ops = &ramdisk_aops;
+ rd_bdev[unit]->bd_inode->i_size = rd_length[unit];
rd_bdev[unit]->bd_queue = &blk_dev[MAJOR_NR].request_queue;
}
diff -Nru a/drivers/block/swim3.c b/drivers/block/swim3.c
--- a/drivers/block/swim3.c Thu Aug 1 14:17:40 2002
+++ b/drivers/block/swim3.c Thu Aug 1 14:17:40 2002
@@ -1034,7 +1034,7 @@
if (floppy_count > 0)
{
- if (devfs_register_blkdev(MAJOR_NR, "fd", &floppy_fops)) {
+ if (register_blkdev(MAJOR_NR, "fd", &floppy_fops)) {
printk(KERN_ERR "Unable to get major %d for floppy\n",
MAJOR_NR);
return -EBUSY;
diff -Nru a/drivers/block/umem.c b/drivers/block/umem.c
--- a/drivers/block/umem.c Thu Aug 1 14:17:41 2002
+++ b/drivers/block/umem.c Thu Aug 1 14:17:41 2002
@@ -160,7 +160,6 @@
static struct timer_list battery_timer;
-static int mm_sizes[MM_MAXCARDS << MM_SHIFT];
static struct hd_struct mm_partitions[MM_MAXCARDS << MM_SHIFT];
static int num_cards = 0;
@@ -1206,7 +1205,6 @@
printk(KERN_INFO DRIVER_VERSION " : " DRIVER_DESC "\n");
memset (cards, 0, MM_MAXCARDS * sizeof(struct cardinfo));
- memset (mm_sizes, 0, (MM_MAXCARDS << MM_SHIFT) * sizeof (int));
memset (mm_partitions, 0,
(MM_MAXCARDS << MM_SHIFT) * sizeof(struct hd_struct));
@@ -1224,11 +1222,6 @@
/* Initialize partition size: partion 0 of each card is the entire card */
for (i = 0; i < num_cards; i++) {
- mm_sizes[i << MM_SHIFT] = cards[i].mm_size;
- }
- mm_gendisk.sizes = mm_sizes;
-
- for (i = 0; i < num_cards; i++) {
spin_lock_init(&cards[i].lock);
mm_partitions[i << MM_SHIFT].nr_sects =
cards[i].mm_size * (1024 / MM_HARDSECT);
@@ -1270,8 +1263,6 @@
pci_unregister_driver(&mm_pci_driver);
unregister_blkdev(MAJOR_NR, "umem");
-
- blk_size [MAJOR_NR] = NULL;
/*
* Get our gendisk structure off the list.
diff -Nru a/drivers/block/xd.c b/drivers/block/xd.c
--- a/drivers/block/xd.c Thu Aug 1 14:17:39 2002
+++ b/drivers/block/xd.c Thu Aug 1 14:17:39 2002
@@ -122,7 +122,6 @@
};
static struct hd_struct xd_struct[XD_MAXDRIVES << 6];
-static int xd_sizes[XD_MAXDRIVES << 6];
static spinlock_t xd_lock = SPIN_LOCK_UNLOCKED;
@@ -133,7 +132,6 @@
major_name: "xd",
minor_shift: 6,
part: xd_struct,
- sizes: xd_sizes,
fops: &xd_fops,
};
@@ -164,7 +162,7 @@
init_timer (&xd_timer); xd_timer.function = xd_wakeup;
init_timer (&xd_watchdog_int); xd_watchdog_int.function = xd_watchdog;
- if (devfs_register_blkdev(MAJOR_NR,"xd",&xd_fops)) {
+ if (register_blkdev(MAJOR_NR,"xd",&xd_fops)) {
printk("xd: Unable to get major number %d\n",MAJOR_NR);
return -1;
}
@@ -1085,7 +1083,7 @@
printk(KERN_INFO "XD: Loaded as a module.\n");
if (!xd_drives) {
/* no drives detected - unload module */
- devfs_unregister_blkdev(MAJOR_NR, "xd");
+ unregister_blkdev(MAJOR_NR, "xd");
xd_done();
return (-1);
}
@@ -1095,7 +1093,7 @@
void cleanup_module(void)
{
- devfs_unregister_blkdev(MAJOR_NR, "xd");
+ unregister_blkdev(MAJOR_NR, "xd");
xd_done();
devfs_unregister (devfs_handle);
if (xd_drives) {
diff -Nru a/drivers/bluetooth/Config.help b/drivers/bluetooth/Config.help
--- a/drivers/bluetooth/Config.help Thu Aug 1 14:17:40 2002
+++ b/drivers/bluetooth/Config.help Thu Aug 1 14:17:40 2002
@@ -62,6 +62,20 @@
Say Y here to compile support for HCI DTL1 devices into the
kernel or say M to compile it as module (dtl1_cs.o).
+HCI BT3C (PC Card) device driver
+CONFIG_BLUEZ_HCIBT3C
+ Bluetooth HCI BT3C (PC Card) driver.
+ This driver provides support for Bluetooth PCMCIA devices with
+ 3Com BT3C interface:
+ 3Com Bluetooth Card (3CRWB6096)
+ HP Bluetooth Card
+
+ The HCI BT3C driver uses external firmware loader program provided in
+ the BlueFW package. For more information, see .
+
+ Say Y here to compile support for HCI BT3C devices into the
+ kernel or say M to compile it as module (bt3c_cs.o).
+
HCI BlueCard (PC Card) device driver
CONFIG_BLUEZ_HCIBLUECARD
Bluetooth HCI BlueCard (PC Card) driver.
diff -Nru a/drivers/bluetooth/Config.in b/drivers/bluetooth/Config.in
--- a/drivers/bluetooth/Config.in Thu Aug 1 14:17:40 2002
+++ b/drivers/bluetooth/Config.in Thu Aug 1 14:17:40 2002
@@ -14,6 +14,8 @@
dep_tristate 'HCI DTL1 (PC Card) driver' CONFIG_BLUEZ_HCIDTL1 $CONFIG_PCMCIA $CONFIG_BLUEZ
+dep_tristate 'HCI BT3C (PC Card) driver' CONFIG_BLUEZ_HCIBT3C $CONFIG_PCMCIA $CONFIG_BLUEZ
+
dep_tristate 'HCI BlueCard (PC Card) driver' CONFIG_BLUEZ_HCIBLUECARD $CONFIG_PCMCIA $CONFIG_BLUEZ
dep_tristate 'HCI VHCI (Virtual HCI device) driver' CONFIG_BLUEZ_HCIVHCI $CONFIG_BLUEZ
diff -Nru a/drivers/bluetooth/Makefile b/drivers/bluetooth/Makefile
--- a/drivers/bluetooth/Makefile Thu Aug 1 14:17:41 2002
+++ b/drivers/bluetooth/Makefile Thu Aug 1 14:17:41 2002
@@ -6,6 +6,7 @@
obj-$(CONFIG_BLUEZ_HCIVHCI) += hci_vhci.o
obj-$(CONFIG_BLUEZ_HCIUART) += hci_uart.o
obj-$(CONFIG_BLUEZ_HCIDTL1) += dtl1_cs.o
+obj-$(CONFIG_BLUEZ_HCIBT3C) += bt3c_cs.o
obj-$(CONFIG_BLUEZ_HCIBLUECARD) += bluecard_cs.o
hci_uart-y := hci_ldisc.o
diff -Nru a/drivers/bluetooth/bluecard_cs.c b/drivers/bluetooth/bluecard_cs.c
--- a/drivers/bluetooth/bluecard_cs.c Thu Aug 1 14:17:40 2002
+++ b/drivers/bluetooth/bluecard_cs.c Thu Aug 1 14:17:40 2002
@@ -89,16 +89,16 @@
} bluecard_info_t;
-void bluecard_config(dev_link_t * link);
+void bluecard_config(dev_link_t *link);
void bluecard_release(u_long arg);
-int bluecard_event(event_t event, int priority, event_callback_args_t * args);
+int bluecard_event(event_t event, int priority, event_callback_args_t *args);
static dev_info_t dev_info = "bluecard_cs";
dev_link_t *bluecard_attach(void);
void bluecard_detach(dev_link_t *);
-dev_link_t *dev_list = NULL;
+static dev_link_t *dev_list = NULL;
/* Default baud rate: 57600, 115200, 230400 or 460800 */
@@ -171,7 +171,7 @@
void bluecard_activity_led_timeout(u_long arg)
{
- bluecard_info_t *info = (bluecard_info_t *) arg;
+ bluecard_info_t *info = (bluecard_info_t *)arg;
unsigned int iobase = info->link.io.BasePort1;
if (test_bit(CARD_HAS_ACTIVITY_LED, &(info->hw_state))) {
@@ -184,7 +184,7 @@
}
-static void bluecard_enable_activity_led(bluecard_info_t * info)
+static void bluecard_enable_activity_led(bluecard_info_t *info)
{
unsigned int iobase = info->link.io.BasePort1;
@@ -208,8 +208,7 @@
/* ======================== Interrupt handling ======================== */
-static int bluecard_write(unsigned int iobase, unsigned int offset,
- __u8 * buf, int len)
+static int bluecard_write(unsigned int iobase, unsigned int offset, __u8 *buf, int len)
{
int i, actual;
@@ -224,7 +223,7 @@
}
-static void bluecard_write_wakeup(bluecard_info_t * info)
+static void bluecard_write_wakeup(bluecard_info_t *info)
{
if (!info) {
printk(KERN_WARNING "bluecard_cs: Call of write_wakeup for unknown device.\n");
@@ -253,15 +252,13 @@
return;
if (test_bit(XMIT_BUFFER_NUMBER, &(info->tx_state))) {
- if (!test_bit
- (XMIT_BUF_TWO_READY, &(info->tx_state)))
+ if (!test_bit(XMIT_BUF_TWO_READY, &(info->tx_state)))
break;
offset = 0x10;
command = REG_COMMAND_TX_BUF_TWO;
ready_bit = XMIT_BUF_TWO_READY;
} else {
- if (!test_bit
- (XMIT_BUF_ONE_READY, &(info->tx_state)))
+ if (!test_bit(XMIT_BUF_ONE_READY, &(info->tx_state)))
break;
offset = 0x00;
command = REG_COMMAND_TX_BUF_ONE;
@@ -272,11 +269,9 @@
break;
if (skb->pkt_type & 0x80) {
-
/* Disable RTS */
info->ctrl_reg |= REG_CONTROL_RTS;
outb(info->ctrl_reg, iobase + REG_CONTROL);
-
}
/* Activate LED */
@@ -349,8 +344,7 @@
}
-static int bluecard_read(unsigned int iobase, unsigned int offset,
- __u8 * buf, int size)
+static int bluecard_read(unsigned int iobase, unsigned int offset, __u8 *buf, int size)
{
int i, n, len;
@@ -378,7 +372,7 @@
}
-static void bluecard_receive(bluecard_info_t * info, unsigned int offset)
+static void bluecard_receive(bluecard_info_t *info, unsigned int offset)
{
unsigned int iobase;
unsigned char buf[31];
@@ -410,7 +404,7 @@
if (info->rx_state == RECV_WAIT_PACKET_TYPE) {
- info->rx_skb->dev = (void *) &(info->hdev);
+ info->rx_skb->dev = (void *)&(info->hdev);
info->rx_skb->pkt_type = buf[i];
switch (info->rx_skb->pkt_type) {
@@ -469,20 +463,20 @@
switch (info->rx_state) {
case RECV_WAIT_EVENT_HEADER:
- eh = (hci_event_hdr *) (info->rx_skb->data);
+ eh = (hci_event_hdr *)(info->rx_skb->data);
info->rx_state = RECV_WAIT_DATA;
info->rx_count = eh->plen;
break;
case RECV_WAIT_ACL_HEADER:
- ah = (hci_acl_hdr *) (info->rx_skb->data);
+ ah = (hci_acl_hdr *)(info->rx_skb->data);
dlen = __le16_to_cpu(ah->dlen);
info->rx_state = RECV_WAIT_DATA;
info->rx_count = dlen;
break;
case RECV_WAIT_SCO_HEADER:
- sh = (hci_sco_hdr *) (info->rx_skb->data);
+ sh = (hci_sco_hdr *)(info->rx_skb->data);
info->rx_state = RECV_WAIT_DATA;
info->rx_count = sh->dlen;
break;
@@ -571,9 +565,8 @@
static int bluecard_hci_set_baud_rate(struct hci_dev *hdev, int baud)
{
- bluecard_info_t *info = (bluecard_info_t *) (hdev->driver_data);
+ bluecard_info_t *info = (bluecard_info_t *)(hdev->driver_data);
struct sk_buff *skb;
- int i;
/* Ericsson baud rate command */
unsigned char cmd[] = { HCI_COMMAND_PKT, 0x09, 0xfc, 0x01, 0x03 };
@@ -604,8 +597,7 @@
break;
}
- for (i = 0; i < sizeof(cmd); i++)
- *skb_put(skb, 1) = cmd[i];
+ memcpy(skb_put(skb, sizeof(cmd)), cmd, sizeof(cmd));
skb_queue_tail(&(info->txq), skb);
@@ -621,7 +613,7 @@
static int bluecard_hci_flush(struct hci_dev *hdev)
{
- bluecard_info_t *info = (bluecard_info_t *) (hdev->driver_data);
+ bluecard_info_t *info = (bluecard_info_t *)(hdev->driver_data);
/* Drop TX queue */
skb_queue_purge(&(info->txq));
@@ -632,7 +624,7 @@
static int bluecard_hci_open(struct hci_dev *hdev)
{
- bluecard_info_t *info = (bluecard_info_t *) (hdev->driver_data);
+ bluecard_info_t *info = (bluecard_info_t *)(hdev->driver_data);
unsigned int iobase = info->link.io.BasePort1;
bluecard_hci_set_baud_rate(hdev, DEFAULT_BAUD_RATE);
@@ -649,7 +641,7 @@
static int bluecard_hci_close(struct hci_dev *hdev)
{
- bluecard_info_t *info = (bluecard_info_t *) (hdev->driver_data);
+ bluecard_info_t *info = (bluecard_info_t *)(hdev->driver_data);
unsigned int iobase = info->link.io.BasePort1;
if (!test_and_clear_bit(HCI_RUNNING, &(hdev->flags)))
@@ -667,14 +659,14 @@
static int bluecard_hci_send_frame(struct sk_buff *skb)
{
bluecard_info_t *info;
- struct hci_dev *hdev = (struct hci_dev *) (skb->dev);
+ struct hci_dev *hdev = (struct hci_dev *)(skb->dev);
if (!hdev) {
printk(KERN_WARNING "bluecard_cs: Frame for unknown HCI device (hdev=NULL).");
return -ENODEV;
}
- info = (bluecard_info_t *) (hdev->driver_data);
+ info = (bluecard_info_t *)(hdev->driver_data);
switch (skb->pkt_type) {
case HCI_COMMAND_PKT:
@@ -703,8 +695,7 @@
}
-static int bluecard_hci_ioctl(struct hci_dev *hdev, unsigned int cmd,
- unsigned long arg)
+static int bluecard_hci_ioctl(struct hci_dev *hdev, unsigned int cmd, unsigned long arg)
{
return -ENOIOCTLCMD;
}
@@ -714,7 +705,7 @@
/* ======================== Card services HCI interaction ======================== */
-int bluecard_open(bluecard_info_t * info)
+int bluecard_open(bluecard_info_t *info)
{
unsigned int iobase = info->link.io.BasePort1;
struct hci_dev *hdev;
@@ -724,7 +715,7 @@
init_timer(&(info->timer));
info->timer.function = &bluecard_activity_led_timeout;
- info->timer.data = (u_long) info;
+ info->timer.data = (u_long)info;
skb_queue_head_init(&(info->txq));
@@ -781,7 +772,8 @@
/* Timeout before it is safe to send the first HCI packet */
set_current_state(TASK_INTERRUPTIBLE);
- schedule_timeout((HZ * 5) / 4); // or set it to 3/2
+ schedule_timeout((HZ * 5) / 4); // or set it to 3/2
+
/* Initialize and register HCI device */
@@ -806,7 +798,7 @@
}
-int bluecard_close(bluecard_info_t * info)
+int bluecard_close(bluecard_info_t *info)
{
unsigned int iobase = info->link.io.BasePort1;
struct hci_dev *hdev = &(info->hdev);
@@ -858,7 +850,7 @@
link->priv = info;
link->release.function = &bluecard_release;
- link->release.data = (u_long) link;
+ link->release.data = (u_long)link;
link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
link->io.NumPorts1 = 8;
link->irq.Attributes = IRQ_TYPE_EXCLUSIVE | IRQ_HANDLE_PRESENT;
@@ -883,9 +875,9 @@
client_reg.dev_info = &dev_info;
client_reg.Attributes = INFO_IO_CLIENT | INFO_CARD_SHARE;
client_reg.EventMask =
- CS_EVENT_CARD_INSERTION | CS_EVENT_CARD_REMOVAL |
- CS_EVENT_RESET_PHYSICAL | CS_EVENT_CARD_RESET |
- CS_EVENT_PM_SUSPEND | CS_EVENT_PM_RESUME;
+ CS_EVENT_CARD_INSERTION | CS_EVENT_CARD_REMOVAL |
+ CS_EVENT_RESET_PHYSICAL | CS_EVENT_CARD_RESET |
+ CS_EVENT_PM_SUSPEND | CS_EVENT_PM_RESUME;
client_reg.event_handler = &bluecard_event;
client_reg.Version = 0x0210;
client_reg.event_callback_args.client_data = link;
@@ -901,7 +893,7 @@
}
-void bluecard_detach(dev_link_t * link)
+void bluecard_detach(dev_link_t *link)
{
bluecard_info_t *info = link->priv;
dev_link_t **linkp;
@@ -917,7 +909,7 @@
del_timer(&link->release);
if (link->state & DEV_CONFIG)
- bluecard_release((u_long) link);
+ bluecard_release((u_long)link);
if (link->handle) {
ret = CardServices(DeregisterClient, link->handle);
@@ -932,8 +924,7 @@
}
-static int get_tuple(int fn, client_handle_t handle, tuple_t * tuple,
- cisparse_t * parse)
+static int get_tuple(int fn, client_handle_t handle, tuple_t *tuple, cisparse_t *parse)
{
int i;
@@ -952,7 +943,7 @@
#define first_tuple(a, b, c) get_tuple(GetFirstTuple, a, b, c)
#define next_tuple(a, b, c) get_tuple(GetNextTuple, a, b, c)
-void bluecard_config(dev_link_t * link)
+void bluecard_config(dev_link_t *link)
{
client_handle_t handle = link->handle;
bluecard_info_t *info = link->priv;
@@ -962,7 +953,7 @@
config_info_t config;
int i, n, last_ret, last_fn;
- tuple.TupleData = (cisdata_t *) buf;
+ tuple.TupleData = (cisdata_t *)buf;
tuple.TupleOffset = 0;
tuple.TupleDataMax = 255;
tuple.Attributes = 0;
@@ -1010,12 +1001,12 @@
goto failed;
}
-
MOD_INC_USE_COUNT;
if (bluecard_open(info) != 0)
goto failed;
+ strcpy(info->node.dev_name, info->hdev.name);
link->dev = &info->node;
link->state &= ~DEV_CONFIG_PENDING;
@@ -1025,13 +1016,13 @@
cs_error(link->handle, last_fn, last_ret);
failed:
- bluecard_release((u_long) link);
+ bluecard_release((u_long)link);
}
void bluecard_release(u_long arg)
{
- dev_link_t *link = (dev_link_t *) arg;
+ dev_link_t *link = (dev_link_t *)arg;
bluecard_info_t *info = link->priv;
if (link->state & DEV_PRESENT)
@@ -1049,8 +1040,7 @@
}
-int bluecard_event(event_t event, int priority,
- event_callback_args_t * args)
+int bluecard_event(event_t event, int priority, event_callback_args_t *args)
{
dev_link_t *link = args->client_data;
bluecard_info_t *info = link->priv;
@@ -1079,8 +1069,7 @@
/* Fall through... */
case CS_EVENT_CARD_RESET:
if (DEV_OK(link))
- CardServices(RequestConfiguration, link->handle,
- &link->conf);
+ CardServices(RequestConfiguration, link->handle, &link->conf);
break;
}
diff -Nru a/drivers/bluetooth/bt3c_cs.c b/drivers/bluetooth/bt3c_cs.c
--- /dev/null Wed Dec 31 16:00:00 1969
+++ b/drivers/bluetooth/bt3c_cs.c Thu Aug 1 14:17:41 2002
@@ -0,0 +1,944 @@
+/*
+ *
+ * Driver for the 3Com Bluetooth PCMCIA card
+ *
+ * Copyright (C) 2001-2002 Marcel Holtmann
+ * Jose Orlando Pereira
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The initial developer of the original code is David A. Hinds
+ * . Portions created by David A. Hinds
+ * are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
+ *
+ */
+
+#include
+#include
+
+#define __KERNEL_SYSCALLS__
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+
+
+
+/* ======================== Module parameters ======================== */
+
+
+/* Bit map of interrupts to choose from */
+static u_int irq_mask = 0xffff;
+static int irq_list[4] = { -1 };
+
+MODULE_PARM(irq_mask, "i");
+MODULE_PARM(irq_list, "1-4i");
+
+MODULE_AUTHOR("Marcel Holtmann , Jose Orlando Pereira ");
+MODULE_DESCRIPTION("BlueZ driver for the 3Com Bluetooth PCMCIA card");
+MODULE_LICENSE("GPL");
+
+
+
+/* ======================== Local structures ======================== */
+
+
+typedef struct bt3c_info_t {
+ dev_link_t link;
+ dev_node_t node;
+
+ struct hci_dev hdev;
+
+ spinlock_t lock; /* For serializing operations */
+
+ struct sk_buff_head txq;
+ unsigned long tx_state;
+
+ unsigned long rx_state;
+ unsigned long rx_count;
+ struct sk_buff *rx_skb;
+} bt3c_info_t;
+
+
+void bt3c_config(dev_link_t *link);
+void bt3c_release(u_long arg);
+int bt3c_event(event_t event, int priority, event_callback_args_t *args);
+
+static dev_info_t dev_info = "bt3c_cs";
+
+dev_link_t *bt3c_attach(void);
+void bt3c_detach(dev_link_t *);
+
+static dev_link_t *dev_list = NULL;
+
+
+/* Transmit states */
+#define XMIT_SENDING 1
+#define XMIT_WAKEUP 2
+#define XMIT_WAITING 8
+
+/* Receiver states */
+#define RECV_WAIT_PACKET_TYPE 0
+#define RECV_WAIT_EVENT_HEADER 1
+#define RECV_WAIT_ACL_HEADER 2
+#define RECV_WAIT_SCO_HEADER 3
+#define RECV_WAIT_DATA 4
+
+
+
+/* ======================== Special I/O functions ======================== */
+
+
+#define DATA_L 0
+#define DATA_H 1
+#define ADDR_L 2
+#define ADDR_H 3
+#define CONTROL 4
+
+
+inline void bt3c_address(unsigned int iobase, unsigned short addr)
+{
+ outb(addr & 0xff, iobase + ADDR_L);
+ outb((addr >> 8) & 0xff, iobase + ADDR_H);
+}
+
+
+inline void bt3c_put(unsigned int iobase, unsigned short value)
+{
+ outb(value & 0xff, iobase + DATA_L);
+ outb((value >> 8) & 0xff, iobase + DATA_H);
+}
+
+
+inline void bt3c_io_write(unsigned int iobase, unsigned short addr, unsigned short value)
+{
+ bt3c_address(iobase, addr);
+ bt3c_put(iobase, value);
+}
+
+
+inline unsigned short bt3c_get(unsigned int iobase)
+{
+ unsigned short value = inb(iobase + DATA_L);
+
+ value |= inb(iobase + DATA_H) << 8;
+
+ return value;
+}
+
+
+inline unsigned short bt3c_read(unsigned int iobase, unsigned short addr)
+{
+ bt3c_address(iobase, addr);
+
+ return bt3c_get(iobase);
+}
+
+
+
+/* ======================== Interrupt handling ======================== */
+
+
+static int bt3c_write(unsigned int iobase, int fifo_size, __u8 *buf, int len)
+{
+ int actual = 0;
+
+ bt3c_address(iobase, 0x7080);
+
+ /* Fill FIFO with current frame */
+ while (actual < len) {
+ /* Transmit next byte */
+ bt3c_put(iobase, buf[actual]);
+ actual++;
+ }
+
+ bt3c_io_write(iobase, 0x7005, actual);
+
+ return actual;
+}
+
+
+static void bt3c_write_wakeup(bt3c_info_t *info, int from)
+{
+ unsigned long flags;
+
+ if (!info) {
+ printk(KERN_WARNING "bt3c_cs: Call of write_wakeup for unknown device.\n");
+ return;
+ }
+
+ if (test_and_set_bit(XMIT_SENDING, &(info->tx_state)))
+ return;
+
+ spin_lock_irqsave(&(info->lock), flags);
+
+ do {
+ register unsigned int iobase = info->link.io.BasePort1;
+ register struct sk_buff *skb;
+ register int len;
+
+ if (!(info->link.state & DEV_PRESENT))
+ break;
+
+
+ if (!(skb = skb_dequeue(&(info->txq)))) {
+ clear_bit(XMIT_SENDING, &(info->tx_state));
+ break;
+ }
+
+ /* Send frame */
+ len = bt3c_write(iobase, 256, skb->data, skb->len);
+
+ if (len != skb->len) {
+ printk(KERN_WARNING "bt3c_cs: very strange\n");
+ }
+
+ kfree_skb(skb);
+
+ info->hdev.stat.byte_tx += len;
+
+ } while (0);
+
+ spin_unlock_irqrestore(&(info->lock), flags);
+}
+
+
+static void bt3c_receive(bt3c_info_t *info)
+{
+ unsigned int iobase;
+ int size = 0, avail;
+
+ if (!info) {
+ printk(KERN_WARNING "bt3c_cs: Call of receive for unknown device.\n");
+ return;
+ }
+
+ iobase = info->link.io.BasePort1;
+
+ avail = bt3c_read(iobase, 0x7006);
+ //printk("bt3c_cs: receiving %d bytes\n", avail);
+
+ bt3c_address(iobase, 0x7480);
+ while (size < avail) {
+ size++;
+ info->hdev.stat.byte_rx++;
+
+ /* Allocate packet */
+ if (info->rx_skb == NULL) {
+ info->rx_state = RECV_WAIT_PACKET_TYPE;
+ info->rx_count = 0;
+ if (!(info->rx_skb = bluez_skb_alloc(HCI_MAX_FRAME_SIZE, GFP_ATOMIC))) {
+ printk(KERN_WARNING "bt3c_cs: Can't allocate mem for new packet.\n");
+ return;
+ }
+ }
+
+
+ if (info->rx_state == RECV_WAIT_PACKET_TYPE) {
+
+ info->rx_skb->dev = (void *)&(info->hdev);
+ info->rx_skb->pkt_type = inb(iobase + DATA_L);
+ inb(iobase + DATA_H);
+ //printk("bt3c: PACKET_TYPE=%02x\n", info->rx_skb->pkt_type);
+
+ switch (info->rx_skb->pkt_type) {
+
+ case HCI_EVENT_PKT:
+ info->rx_state = RECV_WAIT_EVENT_HEADER;
+ info->rx_count = HCI_EVENT_HDR_SIZE;
+ break;
+
+ case HCI_ACLDATA_PKT:
+ info->rx_state = RECV_WAIT_ACL_HEADER;
+ info->rx_count = HCI_ACL_HDR_SIZE;
+ break;
+
+ case HCI_SCODATA_PKT:
+ info->rx_state = RECV_WAIT_SCO_HEADER;
+ info->rx_count = HCI_SCO_HDR_SIZE;
+ break;
+
+ default:
+ /* Unknown packet */
+ printk(KERN_WARNING "bt3c_cs: Unknown HCI packet with type 0x%02x received.\n", info->rx_skb->pkt_type);
+ info->hdev.stat.err_rx++;
+ clear_bit(HCI_RUNNING, &(info->hdev.flags));
+
+ kfree_skb(info->rx_skb);
+ info->rx_skb = NULL;
+ break;
+
+ }
+
+ } else {
+
+ __u8 x = inb(iobase + DATA_L);
+
+ *skb_put(info->rx_skb, 1) = x;
+ inb(iobase + DATA_H);
+ info->rx_count--;
+
+ if (info->rx_count == 0) {
+
+ int dlen;
+ hci_event_hdr *eh;
+ hci_acl_hdr *ah;
+ hci_sco_hdr *sh;
+
+ switch (info->rx_state) {
+
+ case RECV_WAIT_EVENT_HEADER:
+ eh = (hci_event_hdr *)(info->rx_skb->data);
+ info->rx_state = RECV_WAIT_DATA;
+ info->rx_count = eh->plen;
+ break;
+
+ case RECV_WAIT_ACL_HEADER:
+ ah = (hci_acl_hdr *)(info->rx_skb->data);
+ dlen = __le16_to_cpu(ah->dlen);
+ info->rx_state = RECV_WAIT_DATA;
+ info->rx_count = dlen;
+ break;
+
+ case RECV_WAIT_SCO_HEADER:
+ sh = (hci_sco_hdr *)(info->rx_skb->data);
+ info->rx_state = RECV_WAIT_DATA;
+ info->rx_count = sh->dlen;
+ break;
+
+ case RECV_WAIT_DATA:
+ hci_recv_frame(info->rx_skb);
+ info->rx_skb = NULL;
+ break;
+
+ }
+
+ }
+
+ }
+
+ }
+
+ bt3c_io_write(iobase, 0x7006, 0x0000);
+}
+
+
+void bt3c_interrupt(int irq, void *dev_inst, struct pt_regs *regs)
+{
+ bt3c_info_t *info = dev_inst;
+ unsigned int iobase;
+ int iir;
+
+ if (!info) {
+ printk(KERN_WARNING "bt3c_cs: Call of irq %d for unknown device.\n", irq);
+ return;
+ }
+
+ iobase = info->link.io.BasePort1;
+
+ spin_lock(&(info->lock));
+
+ iir = inb(iobase + CONTROL);
+ if (iir & 0x80) {
+ int stat = bt3c_read(iobase, 0x7001);
+
+ if ((stat & 0xff) == 0x7f) {
+ printk(KERN_WARNING "bt3c_cs: STRANGE stat=%04x\n", stat);
+ } else if ((stat & 0xff) != 0xff) {
+ if (stat & 0x0020) {
+ int stat = bt3c_read(iobase, 0x7002) & 0x10;
+ printk(KERN_WARNING "bt3c_cs: antena %s\n", stat ? "OUT" : "IN");
+ }
+ if (stat & 0x0001)
+ bt3c_receive(info);
+ if (stat & 0x0002) {
+ //printk("bt3c_cs: ACK %04x\n", stat);
+ clear_bit(XMIT_SENDING, &(info->tx_state));
+ bt3c_write_wakeup(info, 1);
+ }
+
+ bt3c_io_write(iobase, 0x7001, 0x0000);
+
+ outb(iir, iobase + CONTROL);
+ }
+ }
+
+ spin_unlock(&(info->lock));
+}
+
+
+
+
+/* ======================== HCI interface ======================== */
+
+
+static int bt3c_hci_flush(struct hci_dev *hdev)
+{
+ bt3c_info_t *info = (bt3c_info_t *)(hdev->driver_data);
+
+ /* Drop TX queue */
+ skb_queue_purge(&(info->txq));
+
+ return 0;
+}
+
+
+static int bt3c_hci_open(struct hci_dev *hdev)
+{
+ set_bit(HCI_RUNNING, &(hdev->flags));
+
+ return 0;
+}
+
+
+static int bt3c_hci_close(struct hci_dev *hdev)
+{
+ if (!test_and_clear_bit(HCI_RUNNING, &(hdev->flags)))
+ return 0;
+
+ bt3c_hci_flush(hdev);
+
+ return 0;
+}
+
+
+static int bt3c_hci_send_frame(struct sk_buff *skb)
+{
+ bt3c_info_t *info;
+ struct hci_dev *hdev = (struct hci_dev *)(skb->dev);
+
+ if (!hdev) {
+ printk(KERN_WARNING "bt3c_cs: Frame for unknown HCI device (hdev=NULL).");
+ return -ENODEV;
+ }
+
+ info = (bt3c_info_t *) (hdev->driver_data);
+
+ switch (skb->pkt_type) {
+ case HCI_COMMAND_PKT:
+ hdev->stat.cmd_tx++;
+ break;
+ case HCI_ACLDATA_PKT:
+ hdev->stat.acl_tx++;
+ break;
+ case HCI_SCODATA_PKT:
+ hdev->stat.sco_tx++;
+ break;
+ };
+
+ /* Prepend skb with frame type */
+ memcpy(skb_push(skb, 1), &(skb->pkt_type), 1);
+ skb_queue_tail(&(info->txq), skb);
+
+ bt3c_write_wakeup(info, 0);
+
+ return 0;
+}
+
+
+static void bt3c_hci_destruct(struct hci_dev *hdev)
+{
+}
+
+
+static int bt3c_hci_ioctl(struct hci_dev *hdev, unsigned int cmd, unsigned long arg)
+{
+ return -ENOIOCTLCMD;
+}
+
+
+
+/* ======================== User mode firmware loader ======================== */
+
+
+#define FW_LOADER "/sbin/bluefw"
+static int errno;
+
+
+static int bt3c_fw_loader_exec(void *dev)
+{
+ char *argv[] = { FW_LOADER, "pccard", dev, NULL };
+ char *envp[] = { "HOME=/", "TERM=linux", "PATH=/sbin:/usr/sbin:/bin:/usr/bin", NULL };
+ int err;
+
+ err = exec_usermodehelper(FW_LOADER, argv, envp);
+ if (err)
+ printk(KERN_WARNING "bt3c_cs: Failed to exec \"%s pccard %s\".\n", FW_LOADER, (char *)dev);
+
+ return err;
+}
+
+
+static int bt3c_firmware_load(bt3c_info_t *info)
+{
+ sigset_t tmpsig;
+ char dev[16];
+ pid_t pid;
+ int result;
+
+ /* Check if root fs is mounted */
+ if (!current->fs->root) {
+ printk(KERN_WARNING "bt3c_cs: Root filesystem is not mounted.\n");
+ return -EPERM;
+ }
+
+ sprintf(dev, "%04x", info->link.io.BasePort1);
+
+ pid = kernel_thread(bt3c_fw_loader_exec, (void *)dev, 0);
+ if (pid < 0) {
+ printk(KERN_WARNING "bt3c_cs: Forking of kernel thread failed (errno=%d).\n", -pid);
+ return pid;
+ }
+
+ /* Block signals, everything but SIGKILL/SIGSTOP */
+ spin_lock_irq(¤t->sigmask_lock);
+ tmpsig = current->blocked;
+ siginitsetinv(¤t->blocked, sigmask(SIGKILL) | sigmask(SIGSTOP));
+ recalc_sigpending();
+ spin_unlock_irq(¤t->sigmask_lock);
+
+ result = waitpid(pid, NULL, __WCLONE);
+
+ /* Allow signals again */
+ spin_lock_irq(¤t->sigmask_lock);
+ current->blocked = tmpsig;
+ recalc_sigpending();
+ spin_unlock_irq(¤t->sigmask_lock);
+
+ if (result != pid) {
+ printk(KERN_WARNING "bt3c_cs: Waiting for pid %d failed (errno=%d).\n", pid, -result);
+ return -result;
+ }
+
+ return 0;
+}
+
+
+
+/* ======================== Card services HCI interaction ======================== */
+
+
+int bt3c_open(bt3c_info_t *info)
+{
+ struct hci_dev *hdev;
+ int err;
+
+ spin_lock_init(&(info->lock));
+
+ skb_queue_head_init(&(info->txq));
+
+ info->rx_state = RECV_WAIT_PACKET_TYPE;
+ info->rx_count = 0;
+ info->rx_skb = NULL;
+
+ /* Load firmware */
+
+ if ((err = bt3c_firmware_load(info)) < 0)
+ return err;
+
+ /* Timeout before it is safe to send the first HCI packet */
+
+ set_current_state(TASK_INTERRUPTIBLE);
+ schedule_timeout(HZ);
+
+
+ /* Initialize and register HCI device */
+
+ hdev = &(info->hdev);
+
+ hdev->type = HCI_PCCARD;
+ hdev->driver_data = info;
+
+ hdev->open = bt3c_hci_open;
+ hdev->close = bt3c_hci_close;
+ hdev->flush = bt3c_hci_flush;
+ hdev->send = bt3c_hci_send_frame;
+ hdev->destruct = bt3c_hci_destruct;
+ hdev->ioctl = bt3c_hci_ioctl;
+
+ if (hci_register_dev(hdev) < 0) {
+ printk(KERN_WARNING "bt3c_cs: Can't register HCI device %s.\n", hdev->name);
+ return -ENODEV;
+ }
+
+ return 0;
+}
+
+
+int bt3c_close(bt3c_info_t *info)
+{
+ struct hci_dev *hdev = &(info->hdev);
+
+ bt3c_hci_close(hdev);
+
+ if (hci_unregister_dev(hdev) < 0)
+ printk(KERN_WARNING "bt3c_cs: Can't unregister HCI device %s.\n", hdev->name);
+
+ return 0;
+}
+
+
+
+/* ======================== Card services ======================== */
+
+
+static void cs_error(client_handle_t handle, int func, int ret)
+{
+ error_info_t err = { func, ret };
+
+ CardServices(ReportError, handle, &err);
+}
+
+
+dev_link_t *bt3c_attach(void)
+{
+ bt3c_info_t *info;
+ client_reg_t client_reg;
+ dev_link_t *link;
+ int i, ret;
+
+ /* Create new info device */
+ info = kmalloc(sizeof(*info), GFP_KERNEL);
+ if (!info)
+ return NULL;
+ memset(info, 0, sizeof(*info));
+
+ link = &info->link;
+ link->priv = info;
+
+ link->release.function = &bt3c_release;
+ link->release.data = (u_long)link;
+ link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
+ link->io.NumPorts1 = 8;
+ link->irq.Attributes = IRQ_TYPE_EXCLUSIVE | IRQ_HANDLE_PRESENT;
+ link->irq.IRQInfo1 = IRQ_INFO2_VALID | IRQ_LEVEL_ID;
+
+ if (irq_list[0] == -1)
+ link->irq.IRQInfo2 = irq_mask;
+ else
+ for (i = 0; i < 4; i++)
+ link->irq.IRQInfo2 |= 1 << irq_list[i];
+
+ link->irq.Handler = bt3c_interrupt;
+ link->irq.Instance = info;
+
+ link->conf.Attributes = CONF_ENABLE_IRQ;
+ link->conf.Vcc = 50;
+ link->conf.IntType = INT_MEMORY_AND_IO;
+
+ /* Register with Card Services */
+ link->next = dev_list;
+ dev_list = link;
+ client_reg.dev_info = &dev_info;
+ client_reg.Attributes = INFO_IO_CLIENT | INFO_CARD_SHARE;
+ client_reg.EventMask =
+ CS_EVENT_CARD_INSERTION | CS_EVENT_CARD_REMOVAL |
+ CS_EVENT_RESET_PHYSICAL | CS_EVENT_CARD_RESET |
+ CS_EVENT_PM_SUSPEND | CS_EVENT_PM_RESUME;
+ client_reg.event_handler = &bt3c_event;
+ client_reg.Version = 0x0210;
+ client_reg.event_callback_args.client_data = link;
+
+ ret = CardServices(RegisterClient, &link->handle, &client_reg);
+ if (ret != CS_SUCCESS) {
+ cs_error(link->handle, RegisterClient, ret);
+ bt3c_detach(link);
+ return NULL;
+ }
+
+ return link;
+}
+
+
+void bt3c_detach(dev_link_t *link)
+{
+ bt3c_info_t *info = link->priv;
+ dev_link_t **linkp;
+ int ret;
+
+ /* Locate device structure */
+ for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
+ if (*linkp == link)
+ break;
+
+ if (*linkp == NULL)
+ return;
+
+ del_timer(&link->release);
+
+ if (link->state & DEV_CONFIG)
+ bt3c_release((u_long)link);
+
+ if (link->handle) {
+ ret = CardServices(DeregisterClient, link->handle);
+ if (ret != CS_SUCCESS)
+ cs_error(link->handle, DeregisterClient, ret);
+ }
+
+ /* Unlink device structure, free bits */
+ *linkp = link->next;
+
+ kfree(info);
+}
+
+
+static int get_tuple(int fn, client_handle_t handle, tuple_t *tuple, cisparse_t *parse)
+{
+ int i;
+
+ i = CardServices(fn, handle, tuple);
+ if (i != CS_SUCCESS)
+ return CS_NO_MORE_ITEMS;
+
+ i = CardServices(GetTupleData, handle, tuple);
+ if (i != CS_SUCCESS)
+ return i;
+
+ return CardServices(ParseTuple, handle, tuple, parse);
+}
+
+
+#define first_tuple(a, b, c) get_tuple(GetFirstTuple, a, b, c)
+#define next_tuple(a, b, c) get_tuple(GetNextTuple, a, b, c)
+
+void bt3c_config(dev_link_t *link)
+{
+ static ioaddr_t base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 };
+ client_handle_t handle = link->handle;
+ bt3c_info_t *info = link->priv;
+ tuple_t tuple;
+ u_short buf[256];
+ cisparse_t parse;
+ cistpl_cftable_entry_t *cf = &parse.cftable_entry;
+ config_info_t config;
+ int i, j, try, last_ret, last_fn;
+
+ tuple.TupleData = (cisdata_t *)buf;
+ tuple.TupleOffset = 0;
+ tuple.TupleDataMax = 255;
+ tuple.Attributes = 0;
+
+ /* Get configuration register information */
+ tuple.DesiredTuple = CISTPL_CONFIG;
+ last_ret = first_tuple(handle, &tuple, &parse);
+ if (last_ret != CS_SUCCESS) {
+ last_fn = ParseTuple;
+ goto cs_failed;
+ }
+ link->conf.ConfigBase = parse.config.base;
+ link->conf.Present = parse.config.rmask[0];
+
+ /* Configure card */
+ link->state |= DEV_CONFIG;
+ i = CardServices(GetConfigurationInfo, handle, &config);
+ link->conf.Vcc = config.Vcc;
+
+ /* First pass: look for a config entry that looks normal. */
+ tuple.TupleData = (cisdata_t *)buf;
+ tuple.TupleOffset = 0;
+ tuple.TupleDataMax = 255;
+ tuple.Attributes = 0;
+ tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
+ /* Two tries: without IO aliases, then with aliases */
+ for (try = 0; try < 2; try++) {
+ i = first_tuple(handle, &tuple, &parse);
+ while (i != CS_NO_MORE_ITEMS) {
+ if (i != CS_SUCCESS)
+ goto next_entry;
+ if (cf->vpp1.present & (1 << CISTPL_POWER_VNOM))
+ link->conf.Vpp1 = link->conf.Vpp2 = cf->vpp1.param[CISTPL_POWER_VNOM] / 10000;
+ if ((cf->io.nwin > 0) && (cf->io.win[0].len == 8) && (cf->io.win[0].base != 0)) {
+ link->conf.ConfigIndex = cf->index;
+ link->io.BasePort1 = cf->io.win[0].base;
+ link->io.IOAddrLines = (try == 0) ? 16 : cf->io.flags & CISTPL_IO_LINES_MASK;
+ i = CardServices(RequestIO, link->handle, &link->io);
+ if (i == CS_SUCCESS)
+ goto found_port;
+ }
+next_entry:
+ i = next_tuple(handle, &tuple, &parse);
+ }
+ }
+
+ /* Second pass: try to find an entry that isn't picky about
+ its base address, then try to grab any standard serial port
+ address, and finally try to get any free port. */
+ i = first_tuple(handle, &tuple, &parse);
+ while (i != CS_NO_MORE_ITEMS) {
+ if ((i == CS_SUCCESS) && (cf->io.nwin > 0) && ((cf->io.flags & CISTPL_IO_LINES_MASK) <= 3)) {
+ link->conf.ConfigIndex = cf->index;
+ for (j = 0; j < 5; j++) {
+ link->io.BasePort1 = base[j];
+ link->io.IOAddrLines = base[j] ? 16 : 3;
+ i = CardServices(RequestIO, link->handle, &link->io);
+ if (i == CS_SUCCESS)
+ goto found_port;
+ }
+ }
+ i = next_tuple(handle, &tuple, &parse);
+ }
+
+found_port:
+ if (i != CS_SUCCESS) {
+ printk(KERN_NOTICE "bt3c_cs: No usable port range found. Giving up.\n");
+ cs_error(link->handle, RequestIO, i);
+ goto failed;
+ }
+
+ i = CardServices(RequestIRQ, link->handle, &link->irq);
+ if (i != CS_SUCCESS) {
+ cs_error(link->handle, RequestIRQ, i);
+ link->irq.AssignedIRQ = 0;
+ }
+
+ i = CardServices(RequestConfiguration, link->handle, &link->conf);
+ if (i != CS_SUCCESS) {
+ cs_error(link->handle, RequestConfiguration, i);
+ goto failed;
+ }
+
+ MOD_INC_USE_COUNT;
+
+ if (bt3c_open(info) != 0)
+ goto failed;
+
+ strcpy(info->node.dev_name, info->hdev.name);
+ link->dev = &info->node;
+ link->state &= ~DEV_CONFIG_PENDING;
+
+ return;
+
+cs_failed:
+ cs_error(link->handle, last_fn, last_ret);
+
+failed:
+ bt3c_release((u_long)link);
+}
+
+
+void bt3c_release(u_long arg)
+{
+ dev_link_t *link = (dev_link_t *)arg;
+ bt3c_info_t *info = link->priv;
+
+ if (link->state & DEV_PRESENT)
+ bt3c_close(info);
+
+ MOD_DEC_USE_COUNT;
+
+ link->dev = NULL;
+
+ CardServices(ReleaseConfiguration, link->handle);
+ CardServices(ReleaseIO, link->handle, &link->io);
+ CardServices(ReleaseIRQ, link->handle, &link->irq);
+
+ link->state &= ~DEV_CONFIG;
+}
+
+
+int bt3c_event(event_t event, int priority, event_callback_args_t *args)
+{
+ dev_link_t *link = args->client_data;
+ bt3c_info_t *info = link->priv;
+
+ switch (event) {
+ case CS_EVENT_CARD_REMOVAL:
+ link->state &= ~DEV_PRESENT;
+ if (link->state & DEV_CONFIG) {
+ bt3c_close(info);
+ mod_timer(&link->release, jiffies + HZ / 20);
+ }
+ break;
+ case CS_EVENT_CARD_INSERTION:
+ link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
+ bt3c_config(link);
+ break;
+ case CS_EVENT_PM_SUSPEND:
+ link->state |= DEV_SUSPEND;
+ /* Fall through... */
+ case CS_EVENT_RESET_PHYSICAL:
+ if (link->state & DEV_CONFIG)
+ CardServices(ReleaseConfiguration, link->handle);
+ break;
+ case CS_EVENT_PM_RESUME:
+ link->state &= ~DEV_SUSPEND;
+ /* Fall through... */
+ case CS_EVENT_CARD_RESET:
+ if (DEV_OK(link))
+ CardServices(RequestConfiguration, link->handle, &link->conf);
+ break;
+ }
+
+ return 0;
+}
+
+
+
+/* ======================== Module initialization ======================== */
+
+
+int __init init_bt3c_cs(void)
+{
+ servinfo_t serv;
+ int err;
+
+ CardServices(GetCardServicesInfo, &serv);
+ if (serv.Revision != CS_RELEASE_CODE) {
+ printk(KERN_NOTICE "bt3c_cs: Card Services release does not match!\n");
+ return -1;
+ }
+
+ err = register_pccard_driver(&dev_info, &bt3c_attach, &bt3c_detach);
+
+ return err;
+}
+
+
+void __exit exit_bt3c_cs(void)
+{
+ unregister_pccard_driver(&dev_info);
+
+ while (dev_list != NULL)
+ bt3c_detach(dev_list);
+}
+
+
+module_init(init_bt3c_cs);
+module_exit(exit_bt3c_cs);
diff -Nru a/drivers/bluetooth/dtl1_cs.c b/drivers/bluetooth/dtl1_cs.c
--- a/drivers/bluetooth/dtl1_cs.c Thu Aug 1 14:17:40 2002
+++ b/drivers/bluetooth/dtl1_cs.c Thu Aug 1 14:17:40 2002
@@ -75,23 +75,22 @@
typedef struct dtl1_info_t {
- dev_link_t link;
- dev_node_t node;
+ dev_link_t link;
+ dev_node_t node;
- struct hci_dev hdev;
+ struct hci_dev hdev;
- spinlock_t lock; /* For serializing operations */
+ spinlock_t lock; /* For serializing operations */
- unsigned long flowmask; /* HCI flow mask */
- int ri_latch;
+ unsigned long flowmask; /* HCI flow mask */
+ int ri_latch;
- struct sk_buff_head txq;
- unsigned long tx_state;
-
- unsigned long rx_state;
- unsigned long rx_count;
- struct sk_buff *rx_skb;
+ struct sk_buff_head txq;
+ unsigned long tx_state;
+ unsigned long rx_state;
+ unsigned long rx_count;
+ struct sk_buff *rx_skb;
} dtl1_info_t;
@@ -104,7 +103,7 @@
dev_link_t *dtl1_attach(void);
void dtl1_detach(dev_link_t *);
-dev_link_t *dev_list = NULL;
+static dev_link_t *dev_list = NULL;
/* Transmit states */
@@ -118,282 +117,253 @@
typedef struct {
- u8 type;
- u8 zero;
- u16 len;
-} __attribute__ ((packed)) nsh_t; /* Nokia Specific Header */
+ u8 type;
+ u8 zero;
+ u16 len;
+} __attribute__ ((packed)) nsh_t; /* Nokia Specific Header */
-#define NSHL 4 /* Nokia Specific Header Length */
+#define NSHL 4 /* Nokia Specific Header Length */
/* ======================== Interrupt handling ======================== */
-static int dtl1_write(unsigned int iobase, int fifo_size, __u8 *buf, int len) {
-
- int actual = 0;
-
-
- /* Tx FIFO should be empty */
- if (!(inb(iobase + UART_LSR) & UART_LSR_THRE))
- return 0;
-
-
- /* Fill FIFO with current frame */
- while ((fifo_size-- > 0) && (actual < len)) {
- /* Transmit next byte */
- outb(buf[actual], iobase + UART_TX);
- actual++;
- }
-
-
- return actual;
-
-}
-
-
-static void dtl1_write_wakeup(dtl1_info_t *info) {
-
- if (!info) {
- printk(KERN_WARNING "dtl1_cs: Call of write_wakeup for unknown device.\n");
- return;
- }
-
-
- if (test_bit(XMIT_WAITING, &(info->tx_state))) {
- set_bit(XMIT_WAKEUP, &(info->tx_state));
- return;
- }
-
- if (test_and_set_bit(XMIT_SENDING, &(info->tx_state))) {
- set_bit(XMIT_WAKEUP, &(info->tx_state));
- return;
- }
-
-
- do {
- register unsigned int iobase = info->link.io.BasePort1;
- register struct sk_buff *skb;
- register int len;
-
- clear_bit(XMIT_WAKEUP, &(info->tx_state));
-
- if (!(info->link.state & DEV_PRESENT))
- return;
-
-
- if (!(skb = skb_dequeue(&(info->txq))))
- break;
-
-
- /* Send frame */
- len = dtl1_write(iobase, 32, skb->data, skb->len);
-
- if (len == skb->len) {
- set_bit(XMIT_WAITING, &(info->tx_state));
- kfree_skb(skb);
- }
- else {
- skb_pull(skb, len);
- skb_queue_head(&(info->txq), skb);
- }
-
- info->hdev.stat.byte_tx += len;
-
- } while (test_bit(XMIT_WAKEUP, &(info->tx_state)));
-
-
- clear_bit(XMIT_SENDING, &(info->tx_state));
-
-}
-
-
-static void dtl1_control(dtl1_info_t *info, struct sk_buff *skb) {
-
- u8 flowmask = *(u8 *)skb->data;
- int i;
-
-
- printk(KERN_INFO "dtl1_cs: Nokia control data = ");
- for (i = 0; i < skb->len; i++) {
- printk("%02x ", skb->data[i]);
- }
- printk("\n");
-
-
- /* transition to active state */
- if (((info->flowmask & 0x07) == 0) && ((flowmask & 0x07) != 0)) {
- clear_bit(XMIT_WAITING, &(info->tx_state));
- dtl1_write_wakeup(info);
- }
-
- info->flowmask = flowmask;
-
-
- kfree_skb(skb);
-
-}
-
-
-static void dtl1_receive(dtl1_info_t *info) {
-
- unsigned int iobase;
- nsh_t *nsh;
- int boguscount = 0;
-
-
- if (!info) {
- printk(KERN_WARNING "dtl1_cs: Call of receive for unknown device.\n");
- return;
- }
-
-
- iobase = info->link.io.BasePort1;
-
- do {
- info->hdev.stat.byte_rx++;
-
- /* Allocate packet */
- if (info->rx_skb == NULL)
- if (!(info->rx_skb = bluez_skb_alloc(HCI_MAX_FRAME_SIZE, GFP_ATOMIC))) {
- printk(KERN_WARNING "dtl1_cs: Can't allocate mem for new packet.\n");
- info->rx_state = RECV_WAIT_NSH;
- info->rx_count = NSHL;
- return;
- }
-
-
- *skb_put(info->rx_skb, 1) = inb(iobase + UART_RX);
- nsh = (nsh_t *)info->rx_skb->data;
-
- info->rx_count--;
-
-
- if (info->rx_count == 0) {
-
- switch (info->rx_state) {
- case RECV_WAIT_NSH:
- info->rx_state = RECV_WAIT_DATA;
- info->rx_count = nsh->len + (nsh->len & 0x0001);
- break;
- case RECV_WAIT_DATA:
- info->rx_skb->pkt_type = nsh->type;
-
- /* remove PAD byte if it exists */
- if (nsh->len & 0x0001) {
- info->rx_skb->tail--;
- info->rx_skb->len--;
- }
-
- /* remove NSH */
- skb_pull(info->rx_skb, NSHL);
-
-
- switch (info->rx_skb->pkt_type) {
- case 0x80:
- /* control data for the Nokia Card */
- dtl1_control(info, info->rx_skb);
- break;
- case 0x82:
- case 0x83:
- case 0x84:
- /* send frame to the HCI layer */
- info->rx_skb->dev = (void *)&(info->hdev);
- info->rx_skb->pkt_type &= 0x0f;
- hci_recv_frame(info->rx_skb);
- break;
- default:
- /* unknown packet */
- printk(KERN_WARNING "dtl1_cs: Unknown HCI packet with type 0x%02x received.\n", info->rx_skb->pkt_type);
- kfree_skb(info->rx_skb);
- break;
- }
-
-
- info->rx_state = RECV_WAIT_NSH;
- info->rx_count = NSHL;
- info->rx_skb = NULL;
- break;
- }
-
- }
-
-
- /* Make sure we don't stay here to long */
- if (boguscount++ > 32)
- break;
-
- } while (inb(iobase + UART_LSR) & UART_LSR_DR);
-
-
-}
-
-
-void dtl1_interrupt(int irq, void *dev_inst, struct pt_regs *regs) {
-
- dtl1_info_t *info = dev_inst;
- unsigned int iobase;
- unsigned char msr;
- int boguscount = 0;
- int iir, lsr;
-
-
- if (!info) {
- printk(KERN_WARNING "dtl1_cs: Call of irq %d for unknown device.\n", irq);
- return;
- }
-
-
- iobase = info->link.io.BasePort1;
-
-
- spin_lock(&(info->lock));
-
- iir = inb(iobase + UART_IIR) & UART_IIR_ID;
- while (iir) {
-
- /* Clear interrupt */
- lsr = inb(iobase + UART_LSR);
-
- switch (iir) {
- case UART_IIR_RLSI:
- printk(KERN_NOTICE "dtl1_cs: RLSI\n");
- break;
- case UART_IIR_RDI:
- /* Receive interrupt */
- dtl1_receive(info);
- break;
- case UART_IIR_THRI:
- if (lsr & UART_LSR_THRE) {
- /* Transmitter ready for data */
- dtl1_write_wakeup(info);
- }
- break;
- default:
- printk(KERN_NOTICE "dtl1_cs: Unhandled IIR=%#x\n", iir);
- break;
- }
-
- /* Make sure we don't stay here to long */
- if (boguscount++ > 100)
- break;
-
- iir = inb(iobase + UART_IIR) & UART_IIR_ID;
-
- }
-
-
- msr = inb(iobase + UART_MSR);
-
- if (info->ri_latch ^ (msr & UART_MSR_RI)) {
- info->ri_latch = msr & UART_MSR_RI;
- clear_bit(XMIT_WAITING, &(info->tx_state));
- dtl1_write_wakeup(info);
- }
-
- spin_unlock(&(info->lock));
+static int dtl1_write(unsigned int iobase, int fifo_size, __u8 *buf, int len)
+{
+ int actual = 0;
+
+ /* Tx FIFO should be empty */
+ if (!(inb(iobase + UART_LSR) & UART_LSR_THRE))
+ return 0;
+
+ /* Fill FIFO with current frame */
+ while ((fifo_size-- > 0) && (actual < len)) {
+ /* Transmit next byte */
+ outb(buf[actual], iobase + UART_TX);
+ actual++;
+ }
+
+ return actual;
+}
+
+
+static void dtl1_write_wakeup(dtl1_info_t *info)
+{
+ if (!info) {
+ printk(KERN_WARNING "dtl1_cs: Call of write_wakeup for unknown device.\n");
+ return;
+ }
+
+ if (test_bit(XMIT_WAITING, &(info->tx_state))) {
+ set_bit(XMIT_WAKEUP, &(info->tx_state));
+ return;
+ }
+
+ if (test_and_set_bit(XMIT_SENDING, &(info->tx_state))) {
+ set_bit(XMIT_WAKEUP, &(info->tx_state));
+ return;
+ }
+
+ do {
+ register unsigned int iobase = info->link.io.BasePort1;
+ register struct sk_buff *skb;
+ register int len;
+
+ clear_bit(XMIT_WAKEUP, &(info->tx_state));
+
+ if (!(info->link.state & DEV_PRESENT))
+ return;
+
+ if (!(skb = skb_dequeue(&(info->txq))))
+ break;
+
+ /* Send frame */
+ len = dtl1_write(iobase, 32, skb->data, skb->len);
+
+ if (len == skb->len) {
+ set_bit(XMIT_WAITING, &(info->tx_state));
+ kfree_skb(skb);
+ } else {
+ skb_pull(skb, len);
+ skb_queue_head(&(info->txq), skb);
+ }
+
+ info->hdev.stat.byte_tx += len;
+
+ } while (test_bit(XMIT_WAKEUP, &(info->tx_state)));
+
+ clear_bit(XMIT_SENDING, &(info->tx_state));
+}
+
+
+static void dtl1_control(dtl1_info_t *info, struct sk_buff *skb)
+{
+ u8 flowmask = *(u8 *)skb->data;
+ int i;
+
+ printk(KERN_INFO "dtl1_cs: Nokia control data = ");
+ for (i = 0; i < skb->len; i++) {
+ printk("%02x ", skb->data[i]);
+ }
+ printk("\n");
+
+ /* transition to active state */
+ if (((info->flowmask & 0x07) == 0) && ((flowmask & 0x07) != 0)) {
+ clear_bit(XMIT_WAITING, &(info->tx_state));
+ dtl1_write_wakeup(info);
+ }
+
+ info->flowmask = flowmask;
+
+ kfree_skb(skb);
+}
+
+
+static void dtl1_receive(dtl1_info_t *info)
+{
+ unsigned int iobase;
+ nsh_t *nsh;
+ int boguscount = 0;
+
+ if (!info) {
+ printk(KERN_WARNING "dtl1_cs: Call of receive for unknown device.\n");
+ return;
+ }
+
+ iobase = info->link.io.BasePort1;
+
+ do {
+ info->hdev.stat.byte_rx++;
+
+ /* Allocate packet */
+ if (info->rx_skb == NULL)
+ if (!(info->rx_skb = bluez_skb_alloc(HCI_MAX_FRAME_SIZE, GFP_ATOMIC))) {
+ printk(KERN_WARNING "dtl1_cs: Can't allocate mem for new packet.\n");
+ info->rx_state = RECV_WAIT_NSH;
+ info->rx_count = NSHL;
+ return;
+ }
+
+ *skb_put(info->rx_skb, 1) = inb(iobase + UART_RX);
+ nsh = (nsh_t *)info->rx_skb->data;
+
+ info->rx_count--;
+
+ if (info->rx_count == 0) {
+
+ switch (info->rx_state) {
+ case RECV_WAIT_NSH:
+ info->rx_state = RECV_WAIT_DATA;
+ info->rx_count = nsh->len + (nsh->len & 0x0001);
+ break;
+ case RECV_WAIT_DATA:
+ info->rx_skb->pkt_type = nsh->type;
+
+ /* remove PAD byte if it exists */
+ if (nsh->len & 0x0001) {
+ info->rx_skb->tail--;
+ info->rx_skb->len--;
+ }
+
+ /* remove NSH */
+ skb_pull(info->rx_skb, NSHL);
+
+ switch (info->rx_skb->pkt_type) {
+ case 0x80:
+ /* control data for the Nokia Card */
+ dtl1_control(info, info->rx_skb);
+ break;
+ case 0x82:
+ case 0x83:
+ case 0x84:
+ /* send frame to the HCI layer */
+ info->rx_skb->dev = (void *)&(info->hdev);
+ info->rx_skb->pkt_type &= 0x0f;
+ hci_recv_frame(info->rx_skb);
+ break;
+ default:
+ /* unknown packet */
+ printk(KERN_WARNING "dtl1_cs: Unknown HCI packet with type 0x%02x received.\n", info->rx_skb->pkt_type);
+ kfree_skb(info->rx_skb);
+ break;
+ }
+
+ info->rx_state = RECV_WAIT_NSH;
+ info->rx_count = NSHL;
+ info->rx_skb = NULL;
+ break;
+ }
+
+ }
+
+ /* Make sure we don't stay here to long */
+ if (boguscount++ > 32)
+ break;
+
+ } while (inb(iobase + UART_LSR) & UART_LSR_DR);
+}
+
+
+void dtl1_interrupt(int irq, void *dev_inst, struct pt_regs *regs)
+{
+ dtl1_info_t *info = dev_inst;
+ unsigned int iobase;
+ unsigned char msr;
+ int boguscount = 0;
+ int iir, lsr;
+
+ if (!info) {
+ printk(KERN_WARNING "dtl1_cs: Call of irq %d for unknown device.\n", irq);
+ return;
+ }
+
+ iobase = info->link.io.BasePort1;
+
+ spin_lock(&(info->lock));
+
+ iir = inb(iobase + UART_IIR) & UART_IIR_ID;
+ while (iir) {
+
+ /* Clear interrupt */
+ lsr = inb(iobase + UART_LSR);
+
+ switch (iir) {
+ case UART_IIR_RLSI:
+ printk(KERN_NOTICE "dtl1_cs: RLSI\n");
+ break;
+ case UART_IIR_RDI:
+ /* Receive interrupt */
+ dtl1_receive(info);
+ break;
+ case UART_IIR_THRI:
+ if (lsr & UART_LSR_THRE) {
+ /* Transmitter ready for data */
+ dtl1_write_wakeup(info);
+ }
+ break;
+ default:
+ printk(KERN_NOTICE "dtl1_cs: Unhandled IIR=%#x\n", iir);
+ break;
+ }
+
+ /* Make sure we don't stay here to long */
+ if (boguscount++ > 100)
+ break;
+
+ iir = inb(iobase + UART_IIR) & UART_IIR_ID;
+
+ }
+
+ msr = inb(iobase + UART_MSR);
+
+ if (info->ri_latch ^ (msr & UART_MSR_RI)) {
+ info->ri_latch = msr & UART_MSR_RI;
+ clear_bit(XMIT_WAITING, &(info->tx_state));
+ dtl1_write_wakeup(info);
+ }
+ spin_unlock(&(info->lock));
}
@@ -401,107 +371,94 @@
/* ======================== HCI interface ======================== */
-static int dtl1_hci_open(struct hci_dev *hdev) {
-
- set_bit(HCI_RUNNING, &(hdev->flags));
-
-
- return 0;
+static int dtl1_hci_open(struct hci_dev *hdev)
+{
+ set_bit(HCI_RUNNING, &(hdev->flags));
+ return 0;
}
-static int dtl1_hci_flush(struct hci_dev *hdev) {
-
- dtl1_info_t *info = (dtl1_info_t *)(hdev->driver_data);
-
-
- /* Drop TX queue */
- skb_queue_purge(&(info->txq));
-
+static int dtl1_hci_flush(struct hci_dev *hdev)
+{
+ dtl1_info_t *info = (dtl1_info_t *)(hdev->driver_data);
- return 0;
+ /* Drop TX queue */
+ skb_queue_purge(&(info->txq));
+ return 0;
}
-static int dtl1_hci_close(struct hci_dev *hdev) {
+static int dtl1_hci_close(struct hci_dev *hdev)
+{
+ if (!test_and_clear_bit(HCI_RUNNING, &(hdev->flags)))
+ return 0;
- if (!test_and_clear_bit(HCI_RUNNING, &(hdev->flags)))
- return 0;
-
-
- dtl1_hci_flush(hdev);
-
-
- return 0;
+ dtl1_hci_flush(hdev);
+ return 0;
}
-static int dtl1_hci_send_frame(struct sk_buff *skb) {
-
- dtl1_info_t *info;
- struct hci_dev* hdev = (struct hci_dev *)(skb->dev);
- struct sk_buff *s;
- nsh_t nsh;
-
+static int dtl1_hci_send_frame(struct sk_buff *skb)
+{
+ dtl1_info_t *info;
+ struct hci_dev *hdev = (struct hci_dev *)(skb->dev);
+ struct sk_buff *s;
+ nsh_t nsh;
- if (!hdev) {
- printk(KERN_WARNING "dtl1_cs: Frame for unknown HCI device (hdev=NULL).");
- return -ENODEV;
- }
+ if (!hdev) {
+ printk(KERN_WARNING "dtl1_cs: Frame for unknown HCI device (hdev=NULL).");
+ return -ENODEV;
+ }
- info = (dtl1_info_t *)(hdev->driver_data);
+ info = (dtl1_info_t *)(hdev->driver_data);
+ switch (skb->pkt_type) {
+ case HCI_COMMAND_PKT:
+ hdev->stat.cmd_tx++;
+ nsh.type = 0x81;
+ break;
+ case HCI_ACLDATA_PKT:
+ hdev->stat.acl_tx++;
+ nsh.type = 0x82;
+ break;
+ case HCI_SCODATA_PKT:
+ hdev->stat.sco_tx++;
+ nsh.type = 0x83;
+ break;
+ };
- switch (skb->pkt_type) {
- case HCI_COMMAND_PKT:
- hdev->stat.cmd_tx++;
- nsh.type = 0x81;
- break;
- case HCI_ACLDATA_PKT:
- hdev->stat.acl_tx++;
- nsh.type = 0x82;
- break;
- case HCI_SCODATA_PKT:
- hdev->stat.sco_tx++;
- nsh.type = 0x83;
- break;
- };
+ nsh.zero = 0;
+ nsh.len = skb->len;
- nsh.zero = 0;
- nsh.len = skb->len;
+ s = bluez_skb_alloc(NSHL + skb->len + 1, GFP_ATOMIC);
+ skb_reserve(s, NSHL);
+ memcpy(skb_put(s, skb->len), skb->data, skb->len);
+ if (skb->len & 0x0001)
+ *skb_put(s, 1) = 0; /* PAD */
- s = bluez_skb_alloc(NSHL + skb->len + 1, GFP_ATOMIC);
- skb_reserve(s, NSHL);
- memcpy(skb_put(s, skb->len), skb->data, skb->len);
- if (skb->len & 0x0001)
- *skb_put(s, 1) = 0; /* PAD */
+ /* Prepend skb with Nokia frame header and queue */
+ memcpy(skb_push(s, NSHL), &nsh, NSHL);
+ skb_queue_tail(&(info->txq), s);
- /* Prepend skb with Nokia frame header and queue */
- memcpy(skb_push(s, NSHL), &nsh, NSHL);
- skb_queue_tail(&(info->txq), s);
+ dtl1_write_wakeup(info);
+ kfree_skb(skb);
- dtl1_write_wakeup(info);
-
- kfree_skb(skb);
-
-
- return 0;
-
+ return 0;
}
-static void dtl1_hci_destruct(struct hci_dev *hdev) {
+static void dtl1_hci_destruct(struct hci_dev *hdev)
+{
}
-static int dtl1_hci_ioctl(struct hci_dev *hdev, unsigned int cmd, unsigned long arg) {
-
- return -ENOIOCTLCMD;
-
+static int dtl1_hci_ioctl(struct hci_dev *hdev, unsigned int cmd, unsigned long arg)
+{
+ return -ENOIOCTLCMD;
}
@@ -509,101 +466,91 @@
/* ======================== Card services HCI interaction ======================== */
-int dtl1_open(dtl1_info_t *info) {
+int dtl1_open(dtl1_info_t *info)
+{
+ unsigned long flags;
+ unsigned int iobase = info->link.io.BasePort1;
+ struct hci_dev *hdev;
- unsigned long flags;
- unsigned int iobase = info->link.io.BasePort1;
- struct hci_dev *hdev;
+ spin_lock_init(&(info->lock));
+ skb_queue_head_init(&(info->txq));
- spin_lock_init(&(info->lock));
+ info->rx_state = RECV_WAIT_NSH;
+ info->rx_count = NSHL;
+ info->rx_skb = NULL;
- skb_queue_head_init(&(info->txq));
+ set_bit(XMIT_WAITING, &(info->tx_state));
- info->rx_state = RECV_WAIT_NSH;
- info->rx_count = NSHL;
- info->rx_skb = NULL;
+ spin_lock_irqsave(&(info->lock), flags);
- set_bit(XMIT_WAITING, &(info->tx_state));
+ /* Reset UART */
+ outb(0, iobase + UART_MCR);
+ /* Turn off interrupts */
+ outb(0, iobase + UART_IER);
- spin_lock_irqsave(&(info->lock), flags);
+ /* Initialize UART */
+ outb(UART_LCR_WLEN8, iobase + UART_LCR); /* Reset DLAB */
+ outb((UART_MCR_DTR | UART_MCR_RTS | UART_MCR_OUT2), iobase + UART_MCR);
- /* Reset UART */
- outb(0, iobase + UART_MCR);
+ info->ri_latch = inb(info->link.io.BasePort1 + UART_MSR) & UART_MSR_RI;
- /* Turn off interrupts */
- outb(0, iobase + UART_IER);
+ /* Turn on interrupts */
+ outb(UART_IER_RLSI | UART_IER_RDI | UART_IER_THRI, iobase + UART_IER);
- /* Initialize UART */
- outb(UART_LCR_WLEN8, iobase + UART_LCR); /* Reset DLAB */
- outb((UART_MCR_DTR | UART_MCR_RTS | UART_MCR_OUT2), iobase + UART_MCR);
+ spin_unlock_irqrestore(&(info->lock), flags);
- info->ri_latch = inb(info->link.io.BasePort1 + UART_MSR) & UART_MSR_RI;
+ /* Timeout before it is safe to send the first HCI packet */
+ set_current_state(TASK_INTERRUPTIBLE);
+ schedule_timeout(HZ * 2);
- /* Turn on interrupts */
- outb(UART_IER_RLSI | UART_IER_RDI | UART_IER_THRI, iobase + UART_IER);
- spin_unlock_irqrestore(&(info->lock), flags);
+ /* Initialize and register HCI device */
+ hdev = &(info->hdev);
- /* Timeout before it is safe to send the first HCI packet */
- set_current_state(TASK_INTERRUPTIBLE);
- schedule_timeout(HZ * 2);
+ hdev->type = HCI_PCCARD;
+ hdev->driver_data = info;
+ hdev->open = dtl1_hci_open;
+ hdev->close = dtl1_hci_close;
+ hdev->flush = dtl1_hci_flush;
+ hdev->send = dtl1_hci_send_frame;
+ hdev->destruct = dtl1_hci_destruct;
+ hdev->ioctl = dtl1_hci_ioctl;
- /* Initialize and register HCI device */
-
- hdev = &(info->hdev);
-
- hdev->type = HCI_PCCARD;
- hdev->driver_data = info;
-
- hdev->open = dtl1_hci_open;
- hdev->close = dtl1_hci_close;
- hdev->flush = dtl1_hci_flush;
- hdev->send = dtl1_hci_send_frame;
- hdev->destruct = dtl1_hci_destruct;
- hdev->ioctl = dtl1_hci_ioctl;
-
- if (hci_register_dev(hdev) < 0) {
- printk(KERN_WARNING "dtl1_cs: Can't register HCI device %s.\n", hdev->name);
- return -ENODEV;
- }
-
-
- return 0;
+ if (hci_register_dev(hdev) < 0) {
+ printk(KERN_WARNING "dtl1_cs: Can't register HCI device %s.\n", hdev->name);
+ return -ENODEV;
+ }
+ return 0;
}
-int dtl1_close(dtl1_info_t *info) {
-
- unsigned long flags;
- unsigned int iobase = info->link.io.BasePort1;
- struct hci_dev *hdev = &(info->hdev);
-
-
- dtl1_hci_close(hdev);
-
-
- spin_lock_irqsave(&(info->lock), flags);
-
- /* Reset UART */
- outb(0, iobase + UART_MCR);
+int dtl1_close(dtl1_info_t *info)
+{
+ unsigned long flags;
+ unsigned int iobase = info->link.io.BasePort1;
+ struct hci_dev *hdev = &(info->hdev);
- /* Turn off interrupts */
- outb(0, iobase + UART_IER);
+ dtl1_hci_close(hdev);
- spin_unlock_irqrestore(&(info->lock), flags);
+ spin_lock_irqsave(&(info->lock), flags);
+ /* Reset UART */
+ outb(0, iobase + UART_MCR);
- if (hci_unregister_dev(hdev) < 0)
- printk(KERN_WARNING "dtl1_cs: Can't unregister HCI device %s.\n", hdev->name);
+ /* Turn off interrupts */
+ outb(0, iobase + UART_IER);
+ spin_unlock_irqrestore(&(info->lock), flags);
- return 0;
+ if (hci_unregister_dev(hdev) < 0)
+ printk(KERN_WARNING "dtl1_cs: Can't unregister HCI device %s.\n", hdev->name);
+ return 0;
}
@@ -611,291 +558,267 @@
/* ======================== Card services ======================== */
-static void cs_error(client_handle_t handle, int func, int ret) {
-
- error_info_t err = { func, ret };
-
-
- CardServices(ReportError, handle, &err);
-
-}
-
-
-dev_link_t *dtl1_attach(void) {
-
- dtl1_info_t *info;
- client_reg_t client_reg;
- dev_link_t *link;
- int i, ret;
-
-
- /* Create new info device */
- info = kmalloc(sizeof(*info), GFP_KERNEL);
- if (!info)
- return NULL;
- memset(info, 0, sizeof(*info));
-
-
- link = &info->link;
- link->priv = info;
-
- link->release.function = &dtl1_release;
- link->release.data = (u_long)link;
- link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
- link->io.NumPorts1 = 8;
- link->irq.Attributes = IRQ_TYPE_EXCLUSIVE | IRQ_HANDLE_PRESENT;
- link->irq.IRQInfo1 = IRQ_INFO2_VALID | IRQ_LEVEL_ID;
-
- if (irq_list[0] == -1)
- link->irq.IRQInfo2 = irq_mask;
- else
- for (i = 0; i < 4; i++)
- link->irq.IRQInfo2 |= 1 << irq_list[i];
-
- link->irq.Handler = dtl1_interrupt;
- link->irq.Instance = info;
-
- link->conf.Attributes = CONF_ENABLE_IRQ;
- link->conf.Vcc = 50;
- link->conf.IntType = INT_MEMORY_AND_IO;
-
-
- /* Register with Card Services */
- link->next = dev_list;
- dev_list = link;
- client_reg.dev_info = &dev_info;
- client_reg.Attributes = INFO_IO_CLIENT | INFO_CARD_SHARE;
- client_reg.EventMask = CS_EVENT_CARD_INSERTION | CS_EVENT_CARD_REMOVAL |
- CS_EVENT_RESET_PHYSICAL | CS_EVENT_CARD_RESET |
- CS_EVENT_PM_SUSPEND | CS_EVENT_PM_RESUME;
- client_reg.event_handler = &dtl1_event;
- client_reg.Version = 0x0210;
- client_reg.event_callback_args.client_data = link;
-
- ret = CardServices(RegisterClient, &link->handle, &client_reg);
- if (ret != CS_SUCCESS) {
- cs_error(link->handle, RegisterClient, ret);
- dtl1_detach(link);
- return NULL;
- }
-
-
- return link;
-
-}
-
-
-void dtl1_detach(dev_link_t *link) {
-
- dtl1_info_t *info = link->priv;
- dev_link_t **linkp;
- int ret;
-
-
- /* Locate device structure */
- for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
- if (*linkp == link)
- break;
-
- if (*linkp == NULL)
- return;
-
-
- del_timer(&link->release);
- if (link->state & DEV_CONFIG)
- dtl1_release((u_long)link);
-
-
- if (link->handle) {
- ret = CardServices(DeregisterClient, link->handle);
- if (ret != CS_SUCCESS)
- cs_error(link->handle, DeregisterClient, ret);
- }
-
-
- /* Unlink device structure, free bits */
- *linkp = link->next;
-
- kfree(info);
-
-}
-
-
-static int get_tuple(int fn, client_handle_t handle, tuple_t *tuple,
- cisparse_t *parse) {
-
- int i;
-
-
- i = CardServices(fn, handle, tuple);
- if (i != CS_SUCCESS)
- return CS_NO_MORE_ITEMS;
-
- i = CardServices(GetTupleData, handle, tuple);
- if (i != CS_SUCCESS)
- return i;
-
- return CardServices(ParseTuple, handle, tuple, parse);
+static void cs_error(client_handle_t handle, int func, int ret)
+{
+ error_info_t err = { func, ret };
+
+ CardServices(ReportError, handle, &err);
+}
+
+
+dev_link_t *dtl1_attach(void)
+{
+ dtl1_info_t *info;
+ client_reg_t client_reg;
+ dev_link_t *link;
+ int i, ret;
+
+ /* Create new info device */
+ info = kmalloc(sizeof(*info), GFP_KERNEL);
+ if (!info)
+ return NULL;
+ memset(info, 0, sizeof(*info));
+
+ link = &info->link;
+ link->priv = info;
+
+ link->release.function = &dtl1_release;
+ link->release.data = (u_long)link;
+ link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
+ link->io.NumPorts1 = 8;
+ link->irq.Attributes = IRQ_TYPE_EXCLUSIVE | IRQ_HANDLE_PRESENT;
+ link->irq.IRQInfo1 = IRQ_INFO2_VALID | IRQ_LEVEL_ID;
+
+ if (irq_list[0] == -1)
+ link->irq.IRQInfo2 = irq_mask;
+ else
+ for (i = 0; i < 4; i++)
+ link->irq.IRQInfo2 |= 1 << irq_list[i];
+
+ link->irq.Handler = dtl1_interrupt;
+ link->irq.Instance = info;
+
+ link->conf.Attributes = CONF_ENABLE_IRQ;
+ link->conf.Vcc = 50;
+ link->conf.IntType = INT_MEMORY_AND_IO;
+
+ /* Register with Card Services */
+ link->next = dev_list;
+ dev_list = link;
+ client_reg.dev_info = &dev_info;
+ client_reg.Attributes = INFO_IO_CLIENT | INFO_CARD_SHARE;
+ client_reg.EventMask =
+ CS_EVENT_CARD_INSERTION | CS_EVENT_CARD_REMOVAL |
+ CS_EVENT_RESET_PHYSICAL | CS_EVENT_CARD_RESET |
+ CS_EVENT_PM_SUSPEND | CS_EVENT_PM_RESUME;
+ client_reg.event_handler = &dtl1_event;
+ client_reg.Version = 0x0210;
+ client_reg.event_callback_args.client_data = link;
+
+ ret = CardServices(RegisterClient, &link->handle, &client_reg);
+ if (ret != CS_SUCCESS) {
+ cs_error(link->handle, RegisterClient, ret);
+ dtl1_detach(link);
+ return NULL;
+ }
+
+ return link;
+}
+
+
+void dtl1_detach(dev_link_t *link)
+{
+ dtl1_info_t *info = link->priv;
+ dev_link_t **linkp;
+ int ret;
+
+ /* Locate device structure */
+ for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
+ if (*linkp == link)
+ break;
+
+ if (*linkp == NULL)
+ return;
+
+ del_timer(&link->release);
+ if (link->state & DEV_CONFIG)
+ dtl1_release((u_long)link);
+
+ if (link->handle) {
+ ret = CardServices(DeregisterClient, link->handle);
+ if (ret != CS_SUCCESS)
+ cs_error(link->handle, DeregisterClient, ret);
+ }
+
+ /* Unlink device structure, free bits */
+ *linkp = link->next;
+
+ kfree(info);
+}
+
+
+static int get_tuple(int fn, client_handle_t handle, tuple_t *tuple, cisparse_t *parse)
+{
+ int i;
+
+ i = CardServices(fn, handle, tuple);
+ if (i != CS_SUCCESS)
+ return CS_NO_MORE_ITEMS;
+
+ i = CardServices(GetTupleData, handle, tuple);
+ if (i != CS_SUCCESS)
+ return i;
+ return CardServices(ParseTuple, handle, tuple, parse);
}
#define first_tuple(a, b, c) get_tuple(GetFirstTuple, a, b, c)
#define next_tuple(a, b, c) get_tuple(GetNextTuple, a, b, c)
-void dtl1_config(dev_link_t *link) {
-
- client_handle_t handle = link->handle;
- dtl1_info_t *info = link->priv;
- tuple_t tuple;
- u_short buf[256];
- cisparse_t parse;
- cistpl_cftable_entry_t *cf = &parse.cftable_entry;
- config_info_t config;
- int i, last_ret, last_fn;
-
-
- tuple.TupleData = (cisdata_t *)buf;
- tuple.TupleOffset = 0;
- tuple.TupleDataMax = 255;
- tuple.Attributes = 0;
-
- /* Get configuration register information */
- tuple.DesiredTuple = CISTPL_CONFIG;
- last_ret = first_tuple(handle, &tuple, &parse);
- if (last_ret != CS_SUCCESS) {
- last_fn = ParseTuple;
- goto cs_failed;
- }
- link->conf.ConfigBase = parse.config.base;
- link->conf.Present = parse.config.rmask[0];
-
-
- /* Configure card */
- link->state |= DEV_CONFIG;
- i = CardServices(GetConfigurationInfo, handle, &config);
- link->conf.Vcc = config.Vcc;
-
- tuple.TupleData = (cisdata_t *)buf;
- tuple.TupleOffset = 0; tuple.TupleDataMax = 255;
- tuple.Attributes = 0;
- tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
-
- /* Look for a generic full-sized window */
- link->io.NumPorts1 = 8;
- i = first_tuple(handle, &tuple, &parse);
- while (i != CS_NO_MORE_ITEMS) {
- if ((i == CS_SUCCESS) && (cf->io.nwin == 1) && (cf->io.win[0].len > 8)) {
- link->conf.ConfigIndex = cf->index;
- link->io.BasePort1 = cf->io.win[0].base;
- link->io.NumPorts1 = cf->io.win[0].len; /*yo*/
- link->io.IOAddrLines = cf->io.flags & CISTPL_IO_LINES_MASK;
- i = CardServices(RequestIO, link->handle, &link->io);
- if (i == CS_SUCCESS)
- break;
- }
- i = next_tuple(handle, &tuple, &parse);
- }
-
- if (i != CS_SUCCESS) {
- cs_error(link->handle, RequestIO, i);
- goto failed;
- }
-
- i = CardServices(RequestIRQ, link->handle, &link->irq);
- if (i != CS_SUCCESS) {
- cs_error(link->handle, RequestIRQ, i);
- link->irq.AssignedIRQ = 0;
- }
-
- i = CardServices(RequestConfiguration, link->handle, &link->conf);
- if (i != CS_SUCCESS) {
- cs_error(link->handle, RequestConfiguration, i);
- goto failed;
- }
-
-
- MOD_INC_USE_COUNT;
-
- if (dtl1_open(info) != 0)
- goto failed;
-
-
- link->dev = &info->node;
- link->state &= ~DEV_CONFIG_PENDING;
-
-
- return;
+void dtl1_config(dev_link_t *link)
+{
+ client_handle_t handle = link->handle;
+ dtl1_info_t *info = link->priv;
+ tuple_t tuple;
+ u_short buf[256];
+ cisparse_t parse;
+ cistpl_cftable_entry_t *cf = &parse.cftable_entry;
+ config_info_t config;
+ int i, last_ret, last_fn;
+
+ tuple.TupleData = (cisdata_t *)buf;
+ tuple.TupleOffset = 0;
+ tuple.TupleDataMax = 255;
+ tuple.Attributes = 0;
+
+ /* Get configuration register information */
+ tuple.DesiredTuple = CISTPL_CONFIG;
+ last_ret = first_tuple(handle, &tuple, &parse);
+ if (last_ret != CS_SUCCESS) {
+ last_fn = ParseTuple;
+ goto cs_failed;
+ }
+ link->conf.ConfigBase = parse.config.base;
+ link->conf.Present = parse.config.rmask[0];
+
+ /* Configure card */
+ link->state |= DEV_CONFIG;
+ i = CardServices(GetConfigurationInfo, handle, &config);
+ link->conf.Vcc = config.Vcc;
+
+ tuple.TupleData = (cisdata_t *)buf;
+ tuple.TupleOffset = 0;
+ tuple.TupleDataMax = 255;
+ tuple.Attributes = 0;
+ tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
+
+ /* Look for a generic full-sized window */
+ link->io.NumPorts1 = 8;
+ i = first_tuple(handle, &tuple, &parse);
+ while (i != CS_NO_MORE_ITEMS) {
+ if ((i == CS_SUCCESS) && (cf->io.nwin == 1) && (cf->io.win[0].len > 8)) {
+ link->conf.ConfigIndex = cf->index;
+ link->io.BasePort1 = cf->io.win[0].base;
+ link->io.NumPorts1 = cf->io.win[0].len; /*yo */
+ link->io.IOAddrLines = cf->io.flags & CISTPL_IO_LINES_MASK;
+ i = CardServices(RequestIO, link->handle, &link->io);
+ if (i == CS_SUCCESS)
+ break;
+ }
+ i = next_tuple(handle, &tuple, &parse);
+ }
+
+ if (i != CS_SUCCESS) {
+ cs_error(link->handle, RequestIO, i);
+ goto failed;
+ }
+
+ i = CardServices(RequestIRQ, link->handle, &link->irq);
+ if (i != CS_SUCCESS) {
+ cs_error(link->handle, RequestIRQ, i);
+ link->irq.AssignedIRQ = 0;
+ }
+
+ i = CardServices(RequestConfiguration, link->handle, &link->conf);
+ if (i != CS_SUCCESS) {
+ cs_error(link->handle, RequestConfiguration, i);
+ goto failed;
+ }
+
+ MOD_INC_USE_COUNT;
+
+ if (dtl1_open(info) != 0)
+ goto failed;
+
+ strcpy(info->node.dev_name, info->hdev.name);
+ link->dev = &info->node;
+ link->state &= ~DEV_CONFIG_PENDING;
+ return;
cs_failed:
- cs_error(link->handle, last_fn, last_ret);
-failed:
- dtl1_release((u_long)link);
+ cs_error(link->handle, last_fn, last_ret);
+failed:
+ dtl1_release((u_long)link);
}
-void dtl1_release(u_long arg) {
-
- dev_link_t *link = (dev_link_t *)arg;
- dtl1_info_t *info = link->priv;
-
-
- if (link->state & DEV_PRESENT)
- dtl1_close(info);
-
- MOD_DEC_USE_COUNT;
-
-
- link->dev = NULL;
-
- CardServices(ReleaseConfiguration, link->handle);
- CardServices(ReleaseIO, link->handle, &link->io);
- CardServices(ReleaseIRQ, link->handle, &link->irq);
-
- link->state &= ~DEV_CONFIG;
-
+void dtl1_release(u_long arg)
+{
+ dev_link_t *link = (dev_link_t *)arg;
+ dtl1_info_t *info = link->priv;
+
+ if (link->state & DEV_PRESENT)
+ dtl1_close(info);
+
+ MOD_DEC_USE_COUNT;
+
+ link->dev = NULL;
+
+ CardServices(ReleaseConfiguration, link->handle);
+ CardServices(ReleaseIO, link->handle, &link->io);
+ CardServices(ReleaseIRQ, link->handle, &link->irq);
+
+ link->state &= ~DEV_CONFIG;
}
-int dtl1_event(event_t event, int priority, event_callback_args_t *args) {
-
- dev_link_t *link = args->client_data;
- dtl1_info_t *info = link->priv;
-
-
- switch (event) {
- case CS_EVENT_CARD_REMOVAL:
- link->state &= ~DEV_PRESENT;
- if (link->state & DEV_CONFIG) {
- dtl1_close(info);
- mod_timer(&link->release, jiffies + HZ/20);
- }
- break;
- case CS_EVENT_CARD_INSERTION:
- link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
- dtl1_config(link);
- break;
- case CS_EVENT_PM_SUSPEND:
- link->state |= DEV_SUSPEND;
- /* Fall through... */
- case CS_EVENT_RESET_PHYSICAL:
- if (link->state & DEV_CONFIG)
- CardServices(ReleaseConfiguration, link->handle);
- break;
- case CS_EVENT_PM_RESUME:
- link->state &= ~DEV_SUSPEND;
- /* Fall through... */
- case CS_EVENT_CARD_RESET:
- if (DEV_OK(link))
- CardServices(RequestConfiguration, link->handle, &link->conf);
- break;
- }
-
-
- return 0;
+int dtl1_event(event_t event, int priority, event_callback_args_t *args)
+{
+ dev_link_t *link = args->client_data;
+ dtl1_info_t *info = link->priv;
+
+ switch (event) {
+ case CS_EVENT_CARD_REMOVAL:
+ link->state &= ~DEV_PRESENT;
+ if (link->state & DEV_CONFIG) {
+ dtl1_close(info);
+ mod_timer(&link->release, jiffies + HZ / 20);
+ }
+ break;
+ case CS_EVENT_CARD_INSERTION:
+ link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
+ dtl1_config(link);
+ break;
+ case CS_EVENT_PM_SUSPEND:
+ link->state |= DEV_SUSPEND;
+ /* Fall through... */
+ case CS_EVENT_RESET_PHYSICAL:
+ if (link->state & DEV_CONFIG)
+ CardServices(ReleaseConfiguration, link->handle);
+ break;
+ case CS_EVENT_PM_RESUME:
+ link->state &= ~DEV_SUSPEND;
+ /* Fall through... */
+ case CS_EVENT_CARD_RESET:
+ if (DEV_OK(link))
+ CardServices(RequestConfiguration, link->handle, &link->conf);
+ break;
+ }
+ return 0;
}
@@ -903,33 +826,29 @@
/* ======================== Module initialization ======================== */
-int __init init_dtl1_cs(void) {
+int __init init_dtl1_cs(void)
+{
+ servinfo_t serv;
+ int err;
- servinfo_t serv;
- int err;
+ CardServices(GetCardServicesInfo, &serv);
+ if (serv.Revision != CS_RELEASE_CODE) {
+ printk(KERN_NOTICE "dtl1_cs: Card Services release does not match!\n");
+ return -1;
+ }
+ err = register_pccard_driver(&dev_info, &dtl1_attach, &dtl1_detach);
- CardServices(GetCardServicesInfo, &serv);
- if (serv.Revision != CS_RELEASE_CODE) {
- printk(KERN_NOTICE "dtl1_cs: Card Services release does not match!\n");
- return -1;
- }
-
-
- err = register_pccard_driver(&dev_info, &dtl1_attach, &dtl1_detach);
-
-
- return err;
-
+ return err;
}
-void __exit exit_dtl1_cs(void) {
-
- unregister_pccard_driver(&dev_info);
- while (dev_list != NULL)
- dtl1_detach(dev_list);
+void __exit exit_dtl1_cs(void)
+{
+ unregister_pccard_driver(&dev_info);
+ while (dev_list != NULL)
+ dtl1_detach(dev_list);
}
diff -Nru a/drivers/cdrom/aztcd.c b/drivers/cdrom/aztcd.c
--- a/drivers/cdrom/aztcd.c Thu Aug 1 14:17:41 2002
+++ b/drivers/cdrom/aztcd.c Thu Aug 1 14:17:41 2002
@@ -1931,7 +1931,7 @@
}
devfs_register(NULL, "aztcd", DEVFS_FL_DEFAULT, MAJOR_NR, 0,
S_IFBLK | S_IRUGO | S_IWUGO, &azt_fops, NULL);
- if (devfs_register_blkdev(MAJOR_NR, "aztcd", &azt_fops) != 0) {
+ if (register_blkdev(MAJOR_NR, "aztcd", &azt_fops) != 0) {
printk(KERN_WARNING "aztcd: Unable to get major %d for Aztech"
" CD-ROM\n", MAJOR_NR);
ret = -EIO;
@@ -1957,9 +1957,8 @@
void __exit aztcd_exit(void)
{
- devfs_unregister(devfs_find_handle
- (NULL, "aztcd", 0, 0, DEVFS_SPECIAL_BLK, 0));
- if ((devfs_unregister_blkdev(MAJOR_NR, "aztcd") == -EINVAL)) {
+ devfs_find_and_unregister(NULL, "aztcd", 0, 0, DEVFS_SPECIAL_BLK, 0);
+ if ((unregister_blkdev(MAJOR_NR, "aztcd") == -EINVAL)) {
printk("What's that: can't unregister aztcd\n");
return;
}
diff -Nru a/drivers/cdrom/cdu31a.c b/drivers/cdrom/cdu31a.c
--- a/drivers/cdrom/cdu31a.c Thu Aug 1 14:17:36 2002
+++ b/drivers/cdrom/cdu31a.c Thu Aug 1 14:17:36 2002
@@ -3367,7 +3367,7 @@
if (!request_region(cdu31a_port, 4, "cdu31a"))
goto errout3;
- if (devfs_register_blkdev(MAJOR_NR, "cdu31a", &scd_bdops)) {
+ if (register_blkdev(MAJOR_NR, "cdu31a", &scd_bdops)) {
printk("Unable to get major %d for CDU-31a\n",
MAJOR_NR);
goto errout2;
@@ -3460,7 +3460,7 @@
errout0:
printk("Unable to register CDU-31a with Uniform cdrom driver\n");
blk_cleanup_queue(BLK_DEFAULT_QUEUE(MAJOR_NR));
- if (devfs_unregister_blkdev(MAJOR_NR, "cdu31a")) {
+ if (unregister_blkdev(MAJOR_NR, "cdu31a")) {
printk("Can't unregister block device for cdu31a\n");
}
errout2:
@@ -3477,7 +3477,7 @@
("Can't unregister cdu31a from Uniform cdrom driver\n");
return;
}
- if ((devfs_unregister_blkdev(MAJOR_NR, "cdu31a") == -EINVAL)) {
+ if ((unregister_blkdev(MAJOR_NR, "cdu31a") == -EINVAL)) {
printk("Can't unregister cdu31a\n");
return;
}
diff -Nru a/drivers/cdrom/cm206.c b/drivers/cdrom/cm206.c
--- a/drivers/cdrom/cm206.c Thu Aug 1 14:17:40 2002
+++ b/drivers/cdrom/cm206.c Thu Aug 1 14:17:40 2002
@@ -1367,7 +1367,7 @@
printk("Can't unregister cdrom cm206\n");
return;
}
- if (devfs_unregister_blkdev(MAJOR_NR, "cm206")) {
+ if (unregister_blkdev(MAJOR_NR, "cm206")) {
printk("Can't unregister major cm206\n");
return;
}
@@ -1490,7 +1490,7 @@
return -EIO;
}
printk(".\n");
- if (devfs_register_blkdev(MAJOR_NR, "cm206", &cm206_bdops) != 0) {
+ if (register_blkdev(MAJOR_NR, "cm206", &cm206_bdops) != 0) {
printk(KERN_INFO "Cannot register for major %d!\n",
MAJOR_NR);
cleanup(3);
diff -Nru a/drivers/cdrom/gscd.c b/drivers/cdrom/gscd.c
--- a/drivers/cdrom/gscd.c Thu Aug 1 14:17:36 2002
+++ b/drivers/cdrom/gscd.c Thu Aug 1 14:17:36 2002
@@ -933,9 +933,8 @@
{
CLEAR_TIMER;
- devfs_unregister(devfs_find_handle
- (NULL, "gscd", 0, 0, DEVFS_SPECIAL_BLK, 0));
- if ((devfs_unregister_blkdev(MAJOR_NR, "gscd") == -EINVAL)) {
+ devfs_find_and_unregister(NULL, "gscd", 0, 0, DEVFS_SPECIAL_BLK, 0);
+ if ((unregister_blkdev(MAJOR_NR, "gscd") == -EINVAL)) {
printk("What's that: can't unregister GoldStar-module\n");
return;
}
@@ -1013,7 +1012,7 @@
i++;
}
- if (devfs_register_blkdev(MAJOR_NR, "gscd", &gscd_fops) != 0) {
+ if (register_blkdev(MAJOR_NR, "gscd", &gscd_fops) != 0) {
printk(KERN_WARNING "GSCD: Unable to get major %d for GoldStar "
"CD-ROM\n", MAJOR_NR);
ret = -EIO;
diff -Nru a/drivers/cdrom/mcd.c b/drivers/cdrom/mcd.c
--- a/drivers/cdrom/mcd.c Thu Aug 1 14:17:36 2002
+++ b/drivers/cdrom/mcd.c Thu Aug 1 14:17:36 2002
@@ -1039,7 +1039,7 @@
case 2:
release_region(mcd_port, 4);
case 1:
- if (devfs_unregister_blkdev(MAJOR_NR, "mcd")) {
+ if (unregister_blkdev(MAJOR_NR, "mcd")) {
printk(KERN_WARNING "Can't unregister major mcd\n");
return;
}
@@ -1065,7 +1065,7 @@
return -EIO;
}
- if (devfs_register_blkdev(MAJOR_NR, "mcd", &mcd_bdops) != 0) {
+ if (register_blkdev(MAJOR_NR, "mcd", &mcd_bdops) != 0) {
printk(KERN_ERR "mcd: Unable to get major %d for Mitsumi CD-ROM\n", MAJOR_NR);
return -EIO;
}
diff -Nru a/drivers/cdrom/mcdx.c b/drivers/cdrom/mcdx.c
--- a/drivers/cdrom/mcdx.c Thu Aug 1 14:17:40 2002
+++ b/drivers/cdrom/mcdx.c Thu Aug 1 14:17:40 2002
@@ -1166,7 +1166,7 @@
}
xtrace(INIT, "init() register blkdev\n");
- if (devfs_register_blkdev(MAJOR_NR, "mcdx", &mcdx_bdops) != 0) {
+ if (register_blkdev(MAJOR_NR, "mcdx", &mcdx_bdops) != 0) {
release_region((unsigned long) stuffp->wreg_data,
MCDX_IO_SIZE);
xwarn("%s=0x%3p,%d: Init failed. Can't get major %d.\n",
@@ -1222,7 +1222,7 @@
MCDX_IO_SIZE);
free_irq(stuffp->irq, NULL);
kfree(stuffp);
- if (devfs_unregister_blkdev(MAJOR_NR, "mcdx") != 0)
+ if (unregister_blkdev(MAJOR_NR, "mcdx") != 0)
xwarn("cleanup() unregister_blkdev() failed\n");
blk_cleanup_queue(BLK_DEFAULT_QUEUE(MAJOR_NR));
return 2;
diff -Nru a/drivers/cdrom/optcd.c b/drivers/cdrom/optcd.c
--- a/drivers/cdrom/optcd.c Thu Aug 1 14:17:39 2002
+++ b/drivers/cdrom/optcd.c Thu Aug 1 14:17:39 2002
@@ -2031,8 +2031,7 @@
DEBUG((DEBUG_VFS, "exec_cmd COMINITDOUBLE: %02x", -status));
return -EIO;
}
- if (devfs_register_blkdev(MAJOR_NR, "optcd", &opt_fops) != 0)
- {
+ if (register_blkdev(MAJOR_NR, "optcd", &opt_fops) != 0) {
printk(KERN_ERR "optcd: unable to get major %d\n", MAJOR_NR);
release_region(optcd_port, 4);
return -EIO;
@@ -2051,9 +2050,8 @@
void __exit optcd_exit(void)
{
- devfs_unregister(devfs_find_handle(NULL, "optcd", 0, 0,
- DEVFS_SPECIAL_BLK, 0));
- if (devfs_unregister_blkdev(MAJOR_NR, "optcd") == -EINVAL) {
+ devfs_find_and_unregister(NULL, "optcd", 0, 0, DEVFS_SPECIAL_BLK, 0);
+ if (unregister_blkdev(MAJOR_NR, "optcd") == -EINVAL) {
printk(KERN_ERR "optcd: what's that: can't unregister\n");
return;
}
diff -Nru a/drivers/cdrom/sbpcd.c b/drivers/cdrom/sbpcd.c
--- a/drivers/cdrom/sbpcd.c Thu Aug 1 14:17:36 2002
+++ b/drivers/cdrom/sbpcd.c Thu Aug 1 14:17:36 2002
@@ -5771,7 +5771,7 @@
OUT(MIXER_data,0xCC); /* one nibble per channel, max. value: 0xFF */
#endif /* SOUND_BASE */
- if (devfs_register_blkdev(MAJOR_NR, major_name, &sbpcd_bdops) != 0)
+ if (register_blkdev(MAJOR_NR, major_name, &sbpcd_bdops) != 0)
{
msg(DBG_INF, "Can't get MAJOR %d for Matsushita CDROM\n", MAJOR_NR);
#ifdef MODULE
@@ -5806,7 +5806,7 @@
if (D_S[j].sbp_buf==NULL)
{
msg(DBG_INF,"data buffer (%d frames) not available.\n",D_S[j].sbp_bufsiz);
- if ((devfs_unregister_blkdev(MAJOR_NR, major_name) == -EINVAL))
+ if ((unregister_blkdev(MAJOR_NR, major_name) == -EINVAL))
{
printk("Can't unregister %s\n", major_name);
}
@@ -5858,7 +5858,7 @@
{
int j;
- if ((devfs_unregister_blkdev(MAJOR_NR, major_name) == -EINVAL))
+ if ((unregister_blkdev(MAJOR_NR, major_name) == -EINVAL))
{
msg(DBG_INF, "What's that: can't unregister %s.\n", major_name);
return;
diff -Nru a/drivers/cdrom/sjcd.c b/drivers/cdrom/sjcd.c
--- a/drivers/cdrom/sjcd.c Thu Aug 1 14:17:41 2002
+++ b/drivers/cdrom/sjcd.c Thu Aug 1 14:17:41 2002
@@ -1680,7 +1680,7 @@
printk("SJCD: sjcd=0x%x: ", sjcd_base);
#endif
- if (devfs_register_blkdev(MAJOR_NR, "sjcd", &sjcd_fops) != 0) {
+ if (register_blkdev(MAJOR_NR, "sjcd", &sjcd_fops) != 0) {
printk("SJCD: Unable to get major %d for Sanyo CD-ROM\n",
MAJOR_NR);
return (-EIO);
@@ -1789,7 +1789,7 @@
static int sjcd_cleanup(void)
{
- if ((devfs_unregister_blkdev(MAJOR_NR, "sjcd") == -EINVAL))
+ if ((unregister_blkdev(MAJOR_NR, "sjcd") == -EINVAL))
printk("SJCD: cannot unregister device.\n");
else {
release_region(sjcd_base, 4);
@@ -1802,8 +1802,7 @@
void __exit sjcd_exit(void)
{
- devfs_unregister(devfs_find_handle
- (NULL, "sjcd", 0, 0, DEVFS_SPECIAL_BLK, 0));
+ devfs_find_and_unregister(NULL, "sjcd", 0, 0, DEVFS_SPECIAL_BLK, 0);
if (sjcd_cleanup())
printk("SJCD: module: cannot be removed.\n");
else
diff -Nru a/drivers/cdrom/sonycd535.c b/drivers/cdrom/sonycd535.c
--- a/drivers/cdrom/sonycd535.c Thu Aug 1 14:17:40 2002
+++ b/drivers/cdrom/sonycd535.c Thu Aug 1 14:17:40 2002
@@ -1572,7 +1572,7 @@
MAJOR_NR, 0,
S_IFBLK | S_IRUGO | S_IWUGO,
&cdu_fops, NULL);
- if (devfs_register_blkdev(MAJOR_NR, CDU535_HANDLE, &cdu_fops)) {
+ if (register_blkdev(MAJOR_NR, CDU535_HANDLE, &cdu_fops)) {
printk("Unable to get major %d for %s\n",
MAJOR_NR, CDU535_MESSAGE_NAME);
return -EIO;
@@ -1585,7 +1585,7 @@
kmalloc(sizeof *sony_toc, GFP_KERNEL);
if (sony_toc == NULL) {
blk_cleanup_queue(BLK_DEFAULT_QUEUE(MAJOR_NR));
- devfs_unregister_blkdev(MAJOR_NR, CDU535_HANDLE);
+ unregister_blkdev(MAJOR_NR, CDU535_HANDLE);
devfs_unregister(sony_devfs_handle);
return -ENOMEM;
}
@@ -1594,7 +1594,7 @@
if (last_sony_subcode == NULL) {
blk_cleanup_queue(BLK_DEFAULT_QUEUE(MAJOR_NR));
kfree(sony_toc);
- devfs_unregister_blkdev(MAJOR_NR, CDU535_HANDLE);
+ unregister_blkdev(MAJOR_NR, CDU535_HANDLE);
devfs_unregister(sony_devfs_handle);
return -ENOMEM;
}
@@ -1604,7 +1604,7 @@
blk_cleanup_queue(BLK_DEFAULT_QUEUE(MAJOR_NR));
kfree(sony_toc);
kfree(last_sony_subcode);
- devfs_unregister_blkdev(MAJOR_NR, CDU535_HANDLE);
+ unregister_blkdev(MAJOR_NR, CDU535_HANDLE);
devfs_unregister(sony_devfs_handle);
return -ENOMEM;
}
@@ -1618,7 +1618,7 @@
kfree(sony_buffer);
kfree(sony_toc);
kfree(last_sony_subcode);
- devfs_unregister_blkdev(MAJOR_NR, CDU535_HANDLE);
+ unregister_blkdev(MAJOR_NR, CDU535_HANDLE);
devfs_unregister(sony_devfs_handle);
return -ENOMEM;
}
@@ -1643,7 +1643,7 @@
kfree(sony_buffer);
kfree(sony_toc);
kfree(last_sony_subcode);
- devfs_unregister_blkdev(MAJOR_NR, CDU535_HANDLE);
+ unregister_blkdev(MAJOR_NR, CDU535_HANDLE);
devfs_unregister(sony_devfs_handle);
if (sony535_irq_used)
free_irq(sony535_irq_used, NULL);
@@ -1700,9 +1700,9 @@
kfree(sony_buffer);
kfree(last_sony_subcode);
kfree(sony_toc);
- devfs_unregister(devfs_find_handle(NULL, CDU535_HANDLE, 0, 0,
- DEVFS_SPECIAL_BLK, 0));
- if (devfs_unregister_blkdev(MAJOR_NR, CDU535_HANDLE) == -EINVAL)
+ devfs_find_and_unregister(NULL, CDU535_HANDLE, 0, 0,
+ DEVFS_SPECIAL_BLK, 0);
+ if (unregister_blkdev(MAJOR_NR, CDU535_HANDLE) == -EINVAL)
printk("Uh oh, couldn't unregister " CDU535_HANDLE "\n");
else
printk(KERN_INFO CDU535_HANDLE " module released\n");
diff -Nru a/drivers/char/Config.help b/drivers/char/Config.help
--- a/drivers/char/Config.help Thu Aug 1 14:17:40 2002
+++ b/drivers/char/Config.help Thu Aug 1 14:17:40 2002
@@ -1110,3 +1110,9 @@
pSeries machines when partitioned support a hypervisor virtual
console. This driver allows each pSeries partition to have a console
which is accessed via the HMC.
+
+CONFIG_RAW_DRIVER
+ The raw driver permits block devices to be bound to /dev/raw/rawN.
+ Once bound, I/O against /dev/raw/rawN uses efficient zero-copy I/O.
+ See the raw(8) manpage for more details.
+
diff -Nru a/drivers/char/Config.in b/drivers/char/Config.in
--- a/drivers/char/Config.in Thu Aug 1 14:17:37 2002
+++ b/drivers/char/Config.in Thu Aug 1 14:17:37 2002
@@ -198,4 +198,6 @@
tristate 'ACP Modem (Mwave) support' CONFIG_MWAVE
fi
+tristate ' RAW driver (/dev/raw/rawN)' CONFIG_RAW_DRIVER
+
endmenu
diff -Nru a/drivers/char/Makefile b/drivers/char/Makefile
--- a/drivers/char/Makefile Thu Aug 1 14:17:41 2002
+++ b/drivers/char/Makefile Thu Aug 1 14:17:41 2002
@@ -7,7 +7,7 @@
#
FONTMAPFILE = cp437.uni
-obj-y += mem.o tty_io.o n_tty.o tty_ioctl.o raw.o pty.o misc.o random.o
+obj-y += mem.o tty_io.o n_tty.o tty_ioctl.o pty.o misc.o random.o
# All of the (potential) objects that export symbols.
# This list comes from 'grep -l EXPORT_SYMBOL *.[hc]'.
@@ -146,6 +146,7 @@
obj-$(CONFIG_BVME6000_SCC) += generic_serial.o vme_scc.o
obj-$(CONFIG_SERIAL_TX3912) += generic_serial.o serial_tx3912.o
obj-$(CONFIG_HVC_CONSOLE) += hvc_console.o
+obj-$(CONFIG_RAW_DRIVER) += raw.o
obj-$(CONFIG_PRINTER) += lp.o
diff -Nru a/drivers/char/drm/mga_drv.h b/drivers/char/drm/mga_drv.h
--- a/drivers/char/drm/mga_drv.h Thu Aug 1 14:17:41 2002
+++ b/drivers/char/drm/mga_drv.h Thu Aug 1 14:17:41 2002
@@ -38,7 +38,7 @@
u32 tail;
int space;
- volatile int wrapped;
+ volatile long wrapped;
volatile u32 *status;
diff -Nru a/drivers/char/dsp56k.c b/drivers/char/dsp56k.c
--- a/drivers/char/dsp56k.c Thu Aug 1 14:17:40 2002
+++ b/drivers/char/dsp56k.c Thu Aug 1 14:17:40 2002
@@ -510,7 +510,7 @@
return -ENODEV;
}
- if(devfs_register_chrdev(DSP56K_MAJOR, "dsp56k", &dsp56k_fops)) {
+ if(register_chrdev(DSP56K_MAJOR, "dsp56k", &dsp56k_fops)) {
printk("DSP56k driver: Unable to register driver\n");
return -ENODEV;
}
@@ -526,7 +526,7 @@
static void __exit dsp56k_cleanup_driver(void)
{
- devfs_unregister_chrdev(DSP56K_MAJOR, "dsp56k");
+ unregister_chrdev(DSP56K_MAJOR, "dsp56k");
devfs_unregister(devfs_handle);
}
module_exit(dsp56k_cleanup_driver);
diff -Nru a/drivers/char/dtlk.c b/drivers/char/dtlk.c
--- a/drivers/char/dtlk.c Thu Aug 1 14:17:40 2002
+++ b/drivers/char/dtlk.c Thu Aug 1 14:17:40 2002
@@ -340,7 +340,7 @@
dtlk_port_lpc = 0;
dtlk_port_tts = 0;
dtlk_busy = 0;
- dtlk_major = devfs_register_chrdev(0, "dtlk", &dtlk_fops);
+ dtlk_major = register_chrdev(0, "dtlk", &dtlk_fops);
if (dtlk_major == 0) {
printk(KERN_ERR "DoubleTalk PC - cannot register device\n");
return 0;
@@ -369,7 +369,7 @@
signals... */
dtlk_write_tts(DTLK_CLEAR);
- devfs_unregister_chrdev(dtlk_major, "dtlk");
+ unregister_chrdev(dtlk_major, "dtlk");
devfs_unregister(devfs_handle);
release_region(dtlk_port_lpc, DTLK_IO_EXTENT);
}
diff -Nru a/drivers/char/ftape/zftape/zftape-init.c b/drivers/char/ftape/zftape/zftape-init.c
--- a/drivers/char/ftape/zftape/zftape-init.c Thu Aug 1 14:17:40 2002
+++ b/drivers/char/ftape/zftape/zftape-init.c Thu Aug 1 14:17:40 2002
@@ -67,7 +67,7 @@
/* Local vars.
*/
-static int busy_flag;
+static unsigned long busy_flag;
static sigset_t orig_sigmask;
@@ -345,7 +345,7 @@
TRACE(ft_t_info, "zft_init @ 0x%p", zft_init);
TRACE(ft_t_info,
"installing zftape VFS interface for ftape driver ...");
- TRACE_CATCH(devfs_register_chrdev(QIC117_TAPE_MAJOR, "zft", &zft_cdev),);
+ TRACE_CATCH(register_chrdev(QIC117_TAPE_MAJOR, "zft", &zft_cdev),);
for (i = 0; i < 4; i++) {
char devname[9];
@@ -419,24 +419,24 @@
TRACE_FUN(ft_t_flow);
- if (devfs_unregister_chrdev(QIC117_TAPE_MAJOR, "zft") != 0) {
+ if (unregister_chrdev(QIC117_TAPE_MAJOR, "zft") != 0) {
TRACE(ft_t_warn, "failed");
} else {
TRACE(ft_t_info, "successful");
}
for (i = 0; i < 4; i++) {
sprintf(devname, "qft%i", i);
- devfs_unregister(devfs_find_handle(NULL, devname, QIC117_TAPE_MAJOR, i, DEVFS_SPECIAL_CHR, 0));
+ devfs_find_and_unregister(NULL, devname, QIC117_TAPE_MAJOR, i, DEVFS_SPECIAL_CHR, 0);
sprintf(devname, "nqft%i", i);
- devfs_unregister(devfs_find_handle(NULL, devname, QIC117_TAPE_MAJOR, i + 4, DEVFS_SPECIAL_CHR, 0));
+ devfs_find_and_unregister(NULL, devname, QIC117_TAPE_MAJOR, i + 4, DEVFS_SPECIAL_CHR, 0);
sprintf(devname, "zqft%i", i);
- devfs_unregister(devfs_find_handle(NULL, devname, QIC117_TAPE_MAJOR, i + 16, DEVFS_SPECIAL_CHR, 0));
+ devfs_find_and_unregister(NULL, devname, QIC117_TAPE_MAJOR, i + 16, DEVFS_SPECIAL_CHR, 0);
sprintf(devname, "nzqft%i", i);
- devfs_unregister(devfs_find_handle(NULL, devname, QIC117_TAPE_MAJOR, i + 20, DEVFS_SPECIAL_CHR, 0));
+ devfs_find_and_unregister(NULL, devname, QIC117_TAPE_MAJOR, i + 20, DEVFS_SPECIAL_CHR, 0);
sprintf(devname, "rawqft%i", i);
- devfs_unregister(devfs_find_handle(NULL, devname, QIC117_TAPE_MAJOR, i + 32, DEVFS_SPECIAL_CHR, 0));
+ devfs_find_and_unregister(NULL, devname, QIC117_TAPE_MAJOR, i + 32, DEVFS_SPECIAL_CHR, 0);
sprintf(devname, "nrawqft%i", i);
- devfs_unregister(devfs_find_handle(NULL, devname, QIC117_TAPE_MAJOR, i + 36, DEVFS_SPECIAL_CHR, 0));
+ devfs_find_and_unregister(NULL, devname, QIC117_TAPE_MAJOR, i + 36, DEVFS_SPECIAL_CHR, 0);
}
zft_uninit_mem(); /* release remaining memory, if any */
printk(KERN_INFO "zftape successfully unloaded.\n");
diff -Nru a/drivers/char/ip2main.c b/drivers/char/ip2main.c
--- a/drivers/char/ip2main.c Thu Aug 1 14:17:41 2002
+++ b/drivers/char/ip2main.c Thu Aug 1 14:17:41 2002
@@ -531,12 +531,7 @@
if ( ( err = tty_unregister_driver ( &ip2_callout_driver ) ) ) {
printk(KERN_ERR "IP2: failed to unregister callout driver (%d)\n", err);
}
-#ifdef CONFIG_DEVFS_FS
- if ( ( err = devfs_unregister_chrdev ( IP2_IPL_MAJOR, pcIpl ) ) )
-#else
- if ( ( err = unregister_chrdev ( IP2_IPL_MAJOR, pcIpl ) ) )
-#endif
- {
+ if ( ( err = unregister_chrdev ( IP2_IPL_MAJOR, pcIpl ) ) ) {
printk(KERN_ERR "IP2: failed to unregister IPL driver (%d)\n", err);
}
remove_proc_entry("ip2mem", &proc_root);
@@ -866,12 +861,7 @@
printk(KERN_ERR "IP2: failed to register callout driver (%d)\n", err);
} else
/* Register the IPL driver. */
-#ifdef CONFIG_DEVFS_FS
- if (( err = devfs_register_chrdev ( IP2_IPL_MAJOR, pcIpl, &ip2_ipl )))
-#else
- if ( ( err = register_chrdev ( IP2_IPL_MAJOR, pcIpl, &ip2_ipl ) ) )
-#endif
- {
+ if ( ( err = register_chrdev ( IP2_IPL_MAJOR, pcIpl, &ip2_ipl ) ) ) {
printk(KERN_ERR "IP2: failed to register IPL device (%d)\n", err );
} else
/* Register the read_procmem thing */
diff -Nru a/drivers/char/istallion.c b/drivers/char/istallion.c
--- a/drivers/char/istallion.c Thu Aug 1 14:17:36 2002
+++ b/drivers/char/istallion.c Thu Aug 1 14:17:36 2002
@@ -869,7 +869,7 @@
return;
}
devfs_unregister (devfs_handle);
- if ((i = devfs_unregister_chrdev(STL_SIOMEMMAJOR, "staliomem")))
+ if ((i = unregister_chrdev(STL_SIOMEMMAJOR, "staliomem")))
printk("STALLION: failed to un-register serial memory device, "
"errno=%d\n", -i);
if (stli_tmpwritebuf != (char *) NULL)
@@ -5329,7 +5329,7 @@
* Set up a character driver for the shared memory region. We need this
* to down load the slave code image. Also it is a useful debugging tool.
*/
- if (devfs_register_chrdev(STL_SIOMEMMAJOR, "staliomem", &stli_fsiomem))
+ if (register_chrdev(STL_SIOMEMMAJOR, "staliomem", &stli_fsiomem))
printk(KERN_ERR "STALLION: failed to register serial memory "
"device\n");
diff -Nru a/drivers/char/lp.c b/drivers/char/lp.c
--- a/drivers/char/lp.c Thu Aug 1 14:17:36 2002
+++ b/drivers/char/lp.c Thu Aug 1 14:17:36 2002
@@ -903,7 +903,7 @@
lp_table[i].timeout = 10 * HZ;
}
- if (devfs_register_chrdev (LP_MAJOR, "lp", &lp_fops)) {
+ if (register_chrdev (LP_MAJOR, "lp", &lp_fops)) {
printk ("lp: unable to get major %d\n", LP_MAJOR);
return -EIO;
}
@@ -965,7 +965,7 @@
#endif
devfs_unregister (devfs_handle);
- devfs_unregister_chrdev(LP_MAJOR, "lp");
+ unregister_chrdev(LP_MAJOR, "lp");
for (offset = 0; offset < LP_NO; offset++) {
if (lp_table[offset].dev == NULL)
continue;
diff -Nru a/drivers/char/mem.c b/drivers/char/mem.c
--- a/drivers/char/mem.c Thu Aug 1 14:17:40 2002
+++ b/drivers/char/mem.c Thu Aug 1 14:17:40 2002
@@ -651,7 +651,7 @@
int __init chr_dev_init(void)
{
- if (devfs_register_chrdev(MEM_MAJOR,"mem",&memory_fops))
+ if (register_chrdev(MEM_MAJOR,"mem",&memory_fops))
printk("unable to get major %d for memory devs\n", MEM_MAJOR);
memory_devfs_register();
rand_initialize();
diff -Nru a/drivers/char/misc.c b/drivers/char/misc.c
--- a/drivers/char/misc.c Thu Aug 1 14:17:40 2002
+++ b/drivers/char/misc.c Thu Aug 1 14:17:40 2002
@@ -281,7 +281,7 @@
#ifdef CONFIG_I8K
i8k_init();
#endif
- if (devfs_register_chrdev(MISC_MAJOR,"misc",&misc_fops)) {
+ if (register_chrdev(MISC_MAJOR,"misc",&misc_fops)) {
printk("unable to get major %d for misc devices\n",
MISC_MAJOR);
return -EIO;
diff -Nru a/drivers/char/n_r3964.c b/drivers/char/n_r3964.c
--- a/drivers/char/n_r3964.c Thu Aug 1 14:17:41 2002
+++ b/drivers/char/n_r3964.c Thu Aug 1 14:17:41 2002
@@ -13,6 +13,12 @@
* L. Haag
*
* $Log: n_r3964.c,v $
+ * Revision 1.10 2001/03/18 13:02:24 dwmw2
+ * Fix timer usage, use spinlocks properly.
+ *
+ * Revision 1.9 2001/03/18 12:52:14 dwmw2
+ * Merge changes in 2.4.2
+ *
* Revision 1.8 2000/03/23 14:14:54 dwmw2
* Fix race in sleeping in r3964_read()
*
@@ -110,8 +116,6 @@
#define TRACE_Q(fmt, arg...) /**/
#endif
-static void on_timer_1(void*);
-static void on_timer_2(void*);
static void add_tx_queue(struct r3964_info *, struct r3964_block_header *);
static void remove_from_tx_queue(struct r3964_info *pInfo, int error_code);
static void put_char(struct r3964_info *pInfo, unsigned char ch);
@@ -120,7 +124,7 @@
static void transmit_block(struct r3964_info *pInfo);
static void receive_char(struct r3964_info *pInfo, const unsigned char c);
static void receive_error(struct r3964_info *pInfo, const char flag);
-static void on_timeout(struct r3964_info *pInfo);
+static void on_timeout(unsigned long priv);
static int enable_signals(struct r3964_info *pInfo, pid_t pid, int arg);
static int read_telegram(struct r3964_info *pInfo, pid_t pid, unsigned char *buf);
static void add_msg(struct r3964_client_info *pClient, int msg_id, int arg,
@@ -217,7 +221,7 @@
{
int status;
- printk ("r3964: Philips r3964 Driver $Revision: 1.8 $\n");
+ printk ("r3964: Philips r3964 Driver $Revision: 1.10 $\n");
/*
* Register the tty line discipline
@@ -247,40 +251,11 @@
* Protocol implementation routines
*************************************************************/
-static void on_timer_1(void *arg)
-{
- struct r3964_info *pInfo = (struct r3964_info *)arg;
-
- if(pInfo->count_down)
- {
- if(!--pInfo->count_down)
- {
- on_timeout(pInfo);
- }
- }
- queue_task(&pInfo->bh_2, &tq_timer);
-}
-
-static void on_timer_2(void *arg)
-{
- struct r3964_info *pInfo = (struct r3964_info *)arg;
-
- if(pInfo->count_down)
- {
- if(!--pInfo->count_down)
- {
- on_timeout(pInfo);
- }
- }
- queue_task(&pInfo->bh_1, &tq_timer);
-}
-
static void add_tx_queue(struct r3964_info *pInfo, struct r3964_block_header *pHeader)
{
unsigned long flags;
- save_flags(flags);
- cli();
+ spin_lock_irqsave(&pInfo->lock, flags);
pHeader->next = NULL;
@@ -294,7 +269,7 @@
pInfo->tx_last = pHeader;
}
- restore_flags(flags);
+ spin_unlock_irqrestore(&pInfo->lock, flags);
TRACE_Q("add_tx_queue %x, length %d, tx_first = %x",
(int)pHeader, pHeader->length, (int)pInfo->tx_first );
@@ -337,8 +312,7 @@
wake_up_interruptible (&pInfo->read_wait);
}
- save_flags(flags);
- cli();
+ spin_lock_irqsave(&pInfo->lock, flags);
pInfo->tx_first = pHeader->next;
if(pInfo->tx_first==NULL)
@@ -346,7 +320,7 @@
pInfo->tx_last = NULL;
}
- restore_flags(flags);
+ spin_unlock_irqrestore(&pInfo->lock, flags);
kfree(pHeader);
TRACE_M("remove_from_tx_queue - kfree %x",(int)pHeader);
@@ -359,8 +333,7 @@
{
unsigned long flags;
- save_flags(flags);
- cli();
+ spin_lock_irqsave(&pInfo->lock, flags);
pHeader->next = NULL;
@@ -375,7 +348,7 @@
}
pInfo->blocks_in_rx_queue++;
- restore_flags(flags);
+ spin_unlock_irqrestore(&pInfo->lock, flags);
TRACE_Q("add_rx_queue: %x, length = %d, rx_first = %x, count = %d",
(int)pHeader, pHeader->length,
@@ -396,8 +369,7 @@
TRACE_Q("remove_from_rx_queue: %x, length %d",
(int)pHeader, (int)pHeader->length );
- save_flags(flags);
- cli();
+ spin_lock_irqsave(&pInfo->lock, flags);
if(pInfo->rx_first == pHeader)
{
@@ -430,7 +402,7 @@
}
}
- restore_flags(flags);
+ spin_unlock_irqrestore(&pInfo->lock, flags);
kfree(pHeader);
TRACE_M("remove_from_rx_queue - kfree %x",(int)pHeader);
@@ -471,17 +443,16 @@
unsigned long flags;
- save_flags(flags);
- cli();
+ spin_lock_irqsave(&pInfo->lock, flags);
if((pInfo->state == R3964_IDLE) && (pInfo->tx_first!=NULL))
{
pInfo->state = R3964_TX_REQUEST;
- pInfo->count_down = R3964_TO_QVZ;
pInfo->nRetry=0;
pInfo->flags &= ~R3964_ERROR;
-
- restore_flags(flags);
+ mod_timer(&pInfo->tmr, jiffies + R3964_TO_QVZ);
+
+ spin_unlock_irqrestore(&pInfo->lock, flags);
TRACE_PS("trigger_transmit - sent STX");
@@ -492,7 +463,7 @@
}
else
{
- restore_flags(flags);
+ spin_unlock_irqrestore(&pInfo->lock, flags);
}
}
@@ -506,8 +477,8 @@
put_char(pInfo, STX);
flush(pInfo);
pInfo->state = R3964_TX_REQUEST;
- pInfo->count_down = R3964_TO_QVZ;
pInfo->nRetry++;
+ mod_timer(&pInfo->tmr, jiffies + R3964_TO_QVZ);
}
else
{
@@ -566,7 +537,7 @@
put_char(pInfo, pInfo->bcc);
}
pInfo->state = R3964_WAIT_FOR_TX_ACK;
- pInfo->count_down = R3964_TO_QVZ;
+ mod_timer(&pInfo->tmr, jiffies + R3964_TO_QVZ);
}
flush(pInfo);
}
@@ -601,8 +572,8 @@
if(pInfo->nRetrystate=R3964_WAIT_FOR_RX_REPEAT;
- pInfo->count_down = R3964_TO_RX_PANIC;
pInfo->nRetry++;
+ mod_timer(&pInfo->tmr, jiffies + R3964_TO_RX_PANIC);
}
else
{
@@ -616,7 +587,7 @@
/* received block; submit DLE: */
put_char(pInfo, DLE);
flush(pInfo);
- pInfo->count_down=0;
+ del_timer_sync(&pInfo->tmr);
TRACE_PS(" rx success: got %d chars", length);
/* prepare struct r3964_block_header: */
@@ -701,7 +672,7 @@
TRACE_PE("TRANSMITTING - got illegal char");
pInfo->state = R3964_WAIT_ZVZ_BEFORE_TX_RETRY;
- pInfo->count_down = R3964_TO_ZVZ;
+ mod_timer(&pInfo->tmr, jiffies + R3964_TO_ZVZ);
}
break;
case R3964_WAIT_FOR_TX_ACK:
@@ -728,7 +699,7 @@
{
TRACE_PE("IDLE - got STX but no space in rx_queue!");
pInfo->state=R3964_WAIT_FOR_RX_BUF;
- pInfo->count_down = R3964_TO_NO_BUF;
+ mod_timer(&pInfo->tmr, R3964_TO_NO_BUF);
break;
}
start_receiving:
@@ -738,8 +709,8 @@
pInfo->last_rx = 0;
pInfo->flags &= ~R3964_ERROR;
pInfo->state=R3964_RECEIVING;
- pInfo->count_down = R3964_TO_ZVZ;
- pInfo->nRetry = 0;
+ mod_timer(&pInfo->tmr, R3964_TO_ZVZ);
+ pInfo->nRetry = 0;
put_char(pInfo, DLE);
flush(pInfo);
pInfo->bcc = 0;
@@ -765,7 +736,7 @@
if(pInfo->flags & R3964_BCC)
{
pInfo->state = R3964_WAIT_FOR_BCC;
- pInfo->count_down = R3964_TO_ZVZ;
+ mod_timer(&pInfo->tmr, R3964_TO_ZVZ);
}
else
{
@@ -777,7 +748,7 @@
pInfo->last_rx = c;
char_to_buf:
pInfo->rx_buf[pInfo->rx_position++] = c;
- pInfo->count_down = R3964_TO_ZVZ;
+ mod_timer(&pInfo->tmr, R3964_TO_ZVZ);
}
}
/* else: overflow-msg? BUF_SIZE>MTU; should not happen? */
@@ -818,8 +789,10 @@
}
}
-static void on_timeout(struct r3964_info *pInfo)
+static void on_timeout(unsigned long priv)
{
+ struct r3964_info *pInfo = (void *)priv;
+
switch(pInfo->state)
{
case R3964_TX_REQUEST:
@@ -926,6 +899,7 @@
return -ENOMEM;
TRACE_PS("add client %d to client list", pid);
+ spin_lock_init(&pClient->lock);
pClient->sig_flags=arg;
pClient->pid = pid;
pClient->next=pInfo->firstClient;
@@ -989,8 +963,7 @@
return;
}
- save_flags(flags);
- cli();
+ spin_lock_irqsave(&pClient->lock, flags);
pMsg->msg_id = msg_id;
pMsg->arg = arg;
@@ -1014,7 +987,7 @@
{
pBlock->locks++;
}
- restore_flags(flags);
+ spin_unlock_irqrestore(&pClient->lock, flags);
}
else
{
@@ -1049,8 +1022,7 @@
if(pClient->first_msg)
{
- save_flags(flags);
- cli();
+ spin_lock_irqsave(&pClient->lock, flags);
pMsg = pClient->first_msg;
pClient->first_msg = pMsg->next;
@@ -1065,7 +1037,7 @@
remove_client_block(pInfo, pClient);
pClient->next_block_to_read = pMsg->block;
}
- restore_flags(flags);
+ spin_unlock_irqrestore(&pClient->lock, flags);
}
return pMsg;
}
@@ -1137,6 +1109,7 @@
return -ENOMEM;
}
+ spin_lock_init(&pInfo->lock);
pInfo->tty = tty;
init_waitqueue_head (&pInfo->read_wait);
pInfo->priority = R3964_MASTER;
@@ -1149,26 +1122,13 @@
pInfo->firstClient=NULL;
pInfo->state=R3964_IDLE;
pInfo->flags = R3964_DEBUG;
- pInfo->count_down = 0;
pInfo->nRetry = 0;
tty->disc_data = pInfo;
- /*
- * Add 'on_timer' to timer task queue
- * (will be called from timer bh)
- */
- INIT_LIST_HEAD(&pInfo->bh_1.list);
- pInfo->bh_1.sync = 0;
- pInfo->bh_1.routine = &on_timer_1;
- pInfo->bh_1.data = pInfo;
-
- INIT_LIST_HEAD(&pInfo->bh_2.list);
- pInfo->bh_2.sync = 0;
- pInfo->bh_2.routine = &on_timer_2;
- pInfo->bh_2.data = pInfo;
-
- queue_task(&pInfo->bh_1, &tq_timer);
+ INIT_LIST_HEAD(&pInfo->tmr.list);
+ pInfo->tmr.data = (unsigned long)pInfo;
+ pInfo->tmr.function = on_timeout;
return 0;
}
@@ -1187,12 +1147,7 @@
* Make sure that our task queue isn't activated. If it
* is, take it out of the linked list.
*/
- spin_lock_irqsave(&tqueue_lock, flags);
- if (pInfo->bh_1.sync)
- list_del(&pInfo->bh_1.list);
- if (pInfo->bh_2.sync)
- list_del(&pInfo->bh_2.list);
- spin_unlock_irqrestore(&tqueue_lock, flags);
+ del_timer_sync(&pInfo->tmr);
/* Remove client-structs and message queues: */
pClient=pInfo->firstClient;
@@ -1213,11 +1168,10 @@
pClient=pNext;
}
/* Remove jobs from tx_queue: */
- save_flags(flags);
- cli();
+ spin_lock_irqsave(&pInfo->lock, flags);
pHeader=pInfo->tx_first;
pInfo->tx_first=pInfo->tx_last=NULL;
- restore_flags(flags);
+ spin_unlock_irqrestore(&pInfo->lock, flags);
while(pHeader)
{
@@ -1430,10 +1384,9 @@
if(pClient)
{
poll_wait(file, &pInfo->read_wait, wait);
- save_flags(flags);
- cli();
+ spin_lock_irqsave(&pInfo->lock, flags);
pMsg=pClient->first_msg;
- restore_flags(flags);
+ spin_unlock_irqrestore(&pInfo->lock, flags);
if(pMsg)
result |= POLLIN | POLLRDNORM;
}
diff -Nru a/drivers/char/nvram.c b/drivers/char/nvram.c
--- a/drivers/char/nvram.c Thu Aug 1 14:17:40 2002
+++ b/drivers/char/nvram.c Thu Aug 1 14:17:40 2002
@@ -38,12 +38,12 @@
#include
#define PC 1
-#define ATARI 2
+#define ATARI 2
/* select machine configuration */
#if defined(CONFIG_ATARI)
#define MACH ATARI
-#elif defined(__i386__) || defined(__x86_64__) || defined(__arm__) /* and others?? */
+#elif defined(__i386__) || defined(__x86_64__) || defined(__arm__) /* and others?? */
#define MACH PC
#else
#error Cannot build nvram driver for this machine configuration.
@@ -52,12 +52,12 @@
#if MACH == PC
/* RTC in a PC */
-#define CHECK_DRIVER_INIT() 1
+#define CHECK_DRIVER_INIT() 1
/* On PCs, the checksum is built only over bytes 2..31 */
#define PC_CKS_RANGE_START 2
#define PC_CKS_RANGE_END 31
-#define PC_CKS_LOC 32
+#define PC_CKS_LOC 32
#define mach_check_checksum pc_check_checksum
#define mach_set_checksum pc_set_checksum
@@ -70,14 +70,14 @@
/* Special parameters for RTC in Atari machines */
#include
#include
-#define RTC_PORT(x) (TT_RTC_BAS + 2*(x))
-#define CHECK_DRIVER_INIT() (MACH_IS_ATARI && ATARIHW_PRESENT(TT_CLK))
+#define RTC_PORT(x) (TT_RTC_BAS + 2*(x))
+#define CHECK_DRIVER_INIT() (MACH_IS_ATARI && ATARIHW_PRESENT(TT_CLK))
/* On Ataris, the checksum is over all bytes except the checksum bytes
* themselves; these are at the very end */
#define ATARI_CKS_RANGE_START 0
-#define ATARI_CKS_RANGE_END 47
-#define ATARI_CKS_LOC 48
+#define ATARI_CKS_RANGE_END 47
+#define ATARI_CKS_LOC 48
#define mach_check_checksum atari_check_checksum
#define mach_set_checksum atari_set_checksum
@@ -109,46 +109,50 @@
static int nvram_open_cnt; /* #times opened */
static int nvram_open_mode; /* special open modes */
-static spinlock_t nvram_open_lock = SPIN_LOCK_UNLOCKED;
- /* guards nvram_open_cnt and
- nvram_open_mode */
-#define NVRAM_WRITE 1 /* opened for writing (exclusive) */
-#define NVRAM_EXCL 2 /* opened with O_EXCL */
+static spinlock_t nvram_open_lock = SPIN_LOCK_UNLOCKED; /* guards
+ * nvram_open_cnt and
+ * nvram_open_mode */
+#define NVRAM_WRITE 1 /* opened for writing (exclusive) */
+#define NVRAM_EXCL 2 /* opened with O_EXCL */
+
+#define RTC_FIRST_BYTE 14 /* RTC register number of first
+ * NVRAM byte */
+#define NVRAM_BYTES 128-RTC_FIRST_BYTE /* number of NVRAM bytes */
-#define RTC_FIRST_BYTE 14 /* RTC register number of first NVRAM byte */
-#define NVRAM_BYTES 128-RTC_FIRST_BYTE /* number of NVRAM bytes */
+static int mach_check_checksum(void);
+static void mach_set_checksum(void);
-
-static int mach_check_checksum( void );
-static void mach_set_checksum( void );
#ifdef CONFIG_PROC_FS
-static int mach_proc_infos( unsigned char *contents, char *buffer, int *len,
- off_t *begin, off_t offset, int size );
+static int mach_proc_infos(unsigned char *contents, char *buffer, int *len,
+ off_t *begin, off_t offset, int size);
#endif
-
/*
* These are the internal NVRAM access functions, which do NOT disable
* interrupts and do not check the checksum. Both tasks are left to higher
* level function, so they need to be done only once per syscall.
*/
-static __inline__ unsigned char nvram_read_int( int i )
+static __inline__ unsigned char
+nvram_read_int(int i)
{
- return( CMOS_READ( RTC_FIRST_BYTE+i ) );
+ return CMOS_READ(RTC_FIRST_BYTE + i);
}
-static __inline__ void nvram_write_int( unsigned char c, int i )
+static __inline__ void
+nvram_write_int(unsigned char c, int i)
{
- CMOS_WRITE( c, RTC_FIRST_BYTE+i );
+ CMOS_WRITE(c, RTC_FIRST_BYTE + i);
}
-static __inline__ int nvram_check_checksum_int( void )
+static __inline__ int
+nvram_check_checksum_int(void)
{
- return( mach_check_checksum() );
+ return mach_check_checksum();
}
-static __inline__ void nvram_set_checksum_int( void )
+static __inline__ void
+nvram_set_checksum_int(void)
{
mach_set_checksum();
}
@@ -166,178 +170,183 @@
* module), so they access config information themselves.
*/
-unsigned char nvram_read_byte( int i )
+unsigned char
+nvram_read_byte(int i)
{
unsigned long flags;
unsigned char c;
- spin_lock_irqsave (&rtc_lock, flags);
- c = nvram_read_int( i );
- spin_unlock_irqrestore (&rtc_lock, flags);
- return( c );
+ spin_lock_irqsave(&rtc_lock, flags);
+ c = nvram_read_int(i);
+ spin_unlock_irqrestore(&rtc_lock, flags);
+ return c;
}
/* This races nicely with trying to read with checksum checking (nvram_read) */
-void nvram_write_byte( unsigned char c, int i )
+void
+nvram_write_byte(unsigned char c, int i)
{
unsigned long flags;
- spin_lock_irqsave (&rtc_lock, flags);
- nvram_write_int( c, i );
- spin_unlock_irqrestore (&rtc_lock, flags);
+ spin_lock_irqsave(&rtc_lock, flags);
+ nvram_write_int(c, i);
+ spin_unlock_irqrestore(&rtc_lock, flags);
}
-int nvram_check_checksum( void )
+int
+nvram_check_checksum(void)
{
unsigned long flags;
int rv;
- spin_lock_irqsave (&rtc_lock, flags);
+ spin_lock_irqsave(&rtc_lock, flags);
rv = nvram_check_checksum_int();
- spin_unlock_irqrestore (&rtc_lock, flags);
- return( rv );
+ spin_unlock_irqrestore(&rtc_lock, flags);
+ return rv;
}
-void nvram_set_checksum( void )
+void
+nvram_set_checksum(void)
{
unsigned long flags;
- spin_lock_irqsave (&rtc_lock, flags);
+ spin_lock_irqsave(&rtc_lock, flags);
nvram_set_checksum_int();
- spin_unlock_irqrestore (&rtc_lock, flags);
+ spin_unlock_irqrestore(&rtc_lock, flags);
}
#endif /* MACH == ATARI */
-
/*
* The are the file operation function for user access to /dev/nvram
*/
-static long long nvram_llseek(struct file *file,loff_t offset, int origin )
+static long long
+nvram_llseek(struct file *file, loff_t offset, int origin)
{
lock_kernel();
- switch( origin ) {
- case 0:
+ switch (origin) {
+ case 0:
/* nothing to do */
break;
- case 1:
+ case 1:
offset += file->f_pos;
break;
- case 2:
+ case 2:
offset += NVRAM_BYTES;
break;
}
unlock_kernel();
- return( (offset >= 0) ? (file->f_pos = offset) : -EINVAL );
+ return (offset >= 0) ? (file->f_pos = offset) : -EINVAL;
}
-static ssize_t nvram_read(struct file * file,
- char * buf, size_t count, loff_t *ppos )
+static ssize_t
+nvram_read(struct file *file, char *buf, size_t count, loff_t *ppos)
{
- char contents [NVRAM_BYTES];
+ char contents[NVRAM_BYTES];
unsigned i = *ppos;
char *tmp;
- spin_lock_irq (&rtc_lock);
-
+ spin_lock_irq(&rtc_lock);
+
if (!nvram_check_checksum_int())
goto checksum_err;
for (tmp = contents; count-- > 0 && i < NVRAM_BYTES; ++i, ++tmp)
*tmp = nvram_read_int(i);
- spin_unlock_irq (&rtc_lock);
+ spin_unlock_irq(&rtc_lock);
- if (copy_to_user (buf, contents, tmp - contents))
+ if (copy_to_user(buf, contents, tmp - contents))
return -EFAULT;
*ppos = i;
- return (tmp - contents);
+ return tmp - contents;
-checksum_err:
- spin_unlock_irq (&rtc_lock);
+ checksum_err:
+ spin_unlock_irq(&rtc_lock);
return -EIO;
}
-static ssize_t nvram_write(struct file * file,
- const char * buf, size_t count, loff_t *ppos )
+static ssize_t
+nvram_write(struct file *file, const char *buf, size_t count, loff_t *ppos)
{
- char contents [NVRAM_BYTES];
+ char contents[NVRAM_BYTES];
unsigned i = *ppos;
- char * tmp;
+ char *tmp;
- if (copy_from_user (contents, buf, (NVRAM_BYTES - i) < count ?
- (NVRAM_BYTES - i) : count))
+ if (copy_from_user(contents, buf, (NVRAM_BYTES - i) < count ?
+ (NVRAM_BYTES - i) : count))
return -EFAULT;
- spin_lock_irq (&rtc_lock);
+ spin_lock_irq(&rtc_lock);
if (!nvram_check_checksum_int())
goto checksum_err;
for (tmp = contents; count-- > 0 && i < NVRAM_BYTES; ++i, ++tmp)
- nvram_write_int (*tmp, i);
+ nvram_write_int(*tmp, i);
nvram_set_checksum_int();
- spin_unlock_irq (&rtc_lock);
+ spin_unlock_irq(&rtc_lock);
*ppos = i;
- return (tmp - contents);
+ return tmp - contents;
-checksum_err:
- spin_unlock_irq (&rtc_lock);
+ checksum_err:
+ spin_unlock_irq(&rtc_lock);
return -EIO;
}
-static int nvram_ioctl( struct inode *inode, struct file *file,
- unsigned int cmd, unsigned long arg )
+static int
+nvram_ioctl(struct inode *inode, struct file *file,
+ unsigned int cmd, unsigned long arg)
{
int i;
-
- switch( cmd ) {
- case NVRAM_INIT: /* initialize NVRAM contents and checksum */
+ switch (cmd) {
+
+ case NVRAM_INIT: /* initialize NVRAM contents and checksum */
if (!capable(CAP_SYS_ADMIN))
- return( -EACCES );
+ return -EACCES;
- spin_lock_irq (&rtc_lock);
+ spin_lock_irq(&rtc_lock);
- for( i = 0; i < NVRAM_BYTES; ++i )
- nvram_write_int( 0, i );
+ for (i = 0; i < NVRAM_BYTES; ++i)
+ nvram_write_int(0, i);
nvram_set_checksum_int();
-
- spin_unlock_irq (&rtc_lock);
- return( 0 );
-
- case NVRAM_SETCKS: /* just set checksum, contents unchanged
- * (maybe useful after checksum garbaged
- * somehow...) */
+
+ spin_unlock_irq(&rtc_lock);
+ return 0;
+
+ case NVRAM_SETCKS: /* just set checksum, contents unchanged
+ * (maybe useful after checksum garbaged
+ * somehow...) */
if (!capable(CAP_SYS_ADMIN))
- return( -EACCES );
+ return -EACCES;
- spin_lock_irq (&rtc_lock);
+ spin_lock_irq(&rtc_lock);
nvram_set_checksum_int();
- spin_unlock_irq (&rtc_lock);
- return( 0 );
+ spin_unlock_irq(&rtc_lock);
+ return 0;
- default:
- return( -ENOTTY );
+ default:
+ return -ENOTTY;
}
}
-static int nvram_open( struct inode *inode, struct file *file )
+static int
+nvram_open(struct inode *inode, struct file *file)
{
- spin_lock( &nvram_open_lock );
+ spin_lock(&nvram_open_lock);
if ((nvram_open_cnt && (file->f_flags & O_EXCL)) ||
- (nvram_open_mode & NVRAM_EXCL) ||
- ((file->f_mode & 2) && (nvram_open_mode & NVRAM_WRITE)))
- {
- spin_unlock( &nvram_open_lock );
- return( -EBUSY );
+ (nvram_open_mode & NVRAM_EXCL) ||
+ ((file->f_mode & 2) && (nvram_open_mode & NVRAM_WRITE))) {
+ spin_unlock(&nvram_open_lock);
+ return -EBUSY;
}
if (file->f_flags & O_EXCL)
@@ -345,60 +354,65 @@
if (file->f_mode & 2)
nvram_open_mode |= NVRAM_WRITE;
nvram_open_cnt++;
- spin_unlock( &nvram_open_lock );
- return( 0 );
+ spin_unlock(&nvram_open_lock);
+ return 0;
}
-static int nvram_release( struct inode *inode, struct file *file )
+static int
+nvram_release(struct inode *inode, struct file *file)
{
- spin_lock( &nvram_open_lock );
+ spin_lock(&nvram_open_lock);
nvram_open_cnt--;
if (file->f_flags & O_EXCL)
nvram_open_mode &= ~NVRAM_EXCL;
if (file->f_mode & 2)
nvram_open_mode &= ~NVRAM_WRITE;
- spin_unlock( &nvram_open_lock );
- return( 0 );
+ spin_unlock(&nvram_open_lock);
+ return 0;
}
-
#ifndef CONFIG_PROC_FS
-static int nvram_read_proc( char *buffer, char **start, off_t offset,
- int size, int *eof, void *data) { return 0; }
+static int
+nvram_read_proc(char *buffer, char **start, off_t offset,
+ int size, int *eof, void *data)
+{
+ return 0;
+}
#else
-static int nvram_read_proc( char *buffer, char **start, off_t offset,
- int size, int *eof, void *data )
+static int
+nvram_read_proc(char *buffer, char **start, off_t offset,
+ int size, int *eof, void *data)
{
unsigned char contents[NVRAM_BYTES];
- int i, len = 0;
- off_t begin = 0;
+ int i, len = 0;
+ off_t begin = 0;
+
+ spin_lock_irq(&rtc_lock);
+ for (i = 0; i < NVRAM_BYTES; ++i)
+ contents[i] = nvram_read_int(i);
+ spin_unlock_irq(&rtc_lock);
+
+ *eof = mach_proc_infos(contents, buffer, &len, &begin, offset, size);
+
+ if (offset >= begin + len)
+ return 0;
+ *start = buffer + (offset - begin);
+ return (size < begin + len - offset) ? size : begin + len - offset;
- spin_lock_irq (&rtc_lock);
- for( i = 0; i < NVRAM_BYTES; ++i )
- contents[i] = nvram_read_int( i );
- spin_unlock_irq (&rtc_lock);
-
- *eof = mach_proc_infos( contents, buffer, &len, &begin, offset, size );
-
- if (offset >= begin + len)
- return( 0 );
- *start = buffer + (offset - begin);
- return( size < begin + len - offset ? size : begin + len - offset );
-
}
/* This macro frees the machine specific function from bounds checking and
* this like that... */
-#define PRINT_PROC(fmt,args...) \
- do { \
- *len += sprintf( buffer+*len, fmt, ##args ); \
- if (*begin + *len > offset + size) \
- return( 0 ); \
- if (*begin + *len < offset) { \
- *begin += *len; \
- *len = 0; \
- } \
+#define PRINT_PROC(fmt,args...) \
+ do { \
+ *len += sprintf(buffer+*len, fmt, ##args); \
+ if (*begin + *len > offset + size) \
+ return 0; \
+ if (*begin + *len < offset) { \
+ *begin += *len; \
+ *len = 0; \
+ } \
} while(0)
#endif /* CONFIG_PROC_FS */
@@ -419,72 +433,74 @@
&nvram_fops
};
-
-static int __init nvram_init(void)
+static int __init
+nvram_init(void)
{
int ret;
/* First test whether the driver should init at all */
if (!CHECK_DRIVER_INIT())
- return( -ENXIO );
+ return -ENXIO;
- ret = misc_register( &nvram_dev );
+ ret = misc_register(&nvram_dev);
if (ret) {
- printk(KERN_ERR "nvram: can't misc_register on minor=%d\n", NVRAM_MINOR);
+ printk(KERN_ERR "nvram: can't misc_register on minor=%d\n",
+ NVRAM_MINOR);
goto out;
}
- if (!create_proc_read_entry("driver/nvram",0,0,nvram_read_proc,NULL)) {
+ if (!create_proc_read_entry("driver/nvram", 0, 0, nvram_read_proc,
+ NULL)) {
printk(KERN_ERR "nvram: can't create /proc/driver/nvram\n");
ret = -ENOMEM;
goto outmisc;
}
ret = 0;
printk(KERN_INFO "Non-volatile memory driver v" NVRAM_VERSION "\n");
-out:
- return( ret );
-outmisc:
- misc_deregister( &nvram_dev );
+ out:
+ return ret;
+ outmisc:
+ misc_deregister(&nvram_dev);
goto out;
}
-static void __exit nvram_cleanup_module (void)
+static void __exit
+nvram_cleanup_module(void)
{
- remove_proc_entry( "driver/nvram", 0 );
- misc_deregister( &nvram_dev );
+ remove_proc_entry("driver/nvram", 0);
+ misc_deregister(&nvram_dev);
}
module_init(nvram_init);
module_exit(nvram_cleanup_module);
-
/*
* Machine specific functions
*/
-
#if MACH == PC
-static int pc_check_checksum( void )
+static int
+pc_check_checksum(void)
{
int i;
unsigned short sum = 0;
-
- for( i = PC_CKS_RANGE_START; i <= PC_CKS_RANGE_END; ++i )
- sum += nvram_read_int( i );
- return( (sum & 0xffff) ==
- ((nvram_read_int(PC_CKS_LOC) << 8) |
- nvram_read_int(PC_CKS_LOC+1)) );
+
+ for (i = PC_CKS_RANGE_START; i <= PC_CKS_RANGE_END; ++i)
+ sum += nvram_read_int(i);
+ return ((sum & 0xffff) ==
+ ((nvram_read_int(PC_CKS_LOC)<<8) | nvram_read_int(PC_CKS_LOC+1)));
}
-static void pc_set_checksum( void )
+static void
+pc_set_checksum(void)
{
int i;
unsigned short sum = 0;
-
- for( i = PC_CKS_RANGE_START; i <= PC_CKS_RANGE_END; ++i )
- sum += nvram_read_int( i );
- nvram_write_int( sum >> 8, PC_CKS_LOC );
- nvram_write_int( sum & 0xff, PC_CKS_LOC+1 );
+
+ for (i = PC_CKS_RANGE_START; i <= PC_CKS_RANGE_END; ++i)
+ sum += nvram_read_int(i);
+ nvram_write_int(sum >> 8, PC_CKS_LOC);
+ nvram_write_int(sum & 0xff, PC_CKS_LOC + 1);
}
#ifdef CONFIG_PROC_FS
@@ -501,69 +517,67 @@
"monochrome",
};
-static int pc_proc_infos( unsigned char *nvram, char *buffer, int *len,
- off_t *begin, off_t offset, int size )
+static int
+pc_proc_infos(unsigned char *nvram, char *buffer, int *len,
+ off_t *begin, off_t offset, int size)
{
int checksum;
int type;
- spin_lock_irq (&rtc_lock);
+ spin_lock_irq(&rtc_lock);
checksum = nvram_check_checksum_int();
- spin_unlock_irq (&rtc_lock);
+ spin_unlock_irq(&rtc_lock);
- PRINT_PROC( "Checksum status: %svalid\n", checksum ? "" : "not " );
+ PRINT_PROC("Checksum status: %svalid\n", checksum ? "" : "not ");
- PRINT_PROC( "# floppies : %d\n",
- (nvram[6] & 1) ? (nvram[6] >> 6) + 1 : 0 );
- PRINT_PROC( "Floppy 0 type : " );
+ PRINT_PROC("# floppies : %d\n",
+ (nvram[6] & 1) ? (nvram[6] >> 6) + 1 : 0);
+ PRINT_PROC("Floppy 0 type : ");
type = nvram[2] >> 4;
- if (type < sizeof(floppy_types)/sizeof(*floppy_types))
- PRINT_PROC( "%s\n", floppy_types[type] );
+ if (type < sizeof (floppy_types) / sizeof (*floppy_types))
+ PRINT_PROC("%s\n", floppy_types[type]);
else
- PRINT_PROC( "%d (unknown)\n", type );
- PRINT_PROC( "Floppy 1 type : " );
+ PRINT_PROC("%d (unknown)\n", type);
+ PRINT_PROC("Floppy 1 type : ");
type = nvram[2] & 0x0f;
- if (type < sizeof(floppy_types)/sizeof(*floppy_types))
- PRINT_PROC( "%s\n", floppy_types[type] );
+ if (type < sizeof (floppy_types) / sizeof (*floppy_types))
+ PRINT_PROC("%s\n", floppy_types[type]);
else
- PRINT_PROC( "%d (unknown)\n", type );
+ PRINT_PROC("%d (unknown)\n", type);
- PRINT_PROC( "HD 0 type : " );
+ PRINT_PROC("HD 0 type : ");
type = nvram[4] >> 4;
if (type)
- PRINT_PROC( "%02x\n", type == 0x0f ? nvram[11] : type );
+ PRINT_PROC("%02x\n", type == 0x0f ? nvram[11] : type);
else
- PRINT_PROC( "none\n" );
+ PRINT_PROC("none\n");
- PRINT_PROC( "HD 1 type : " );
+ PRINT_PROC("HD 1 type : ");
type = nvram[4] & 0x0f;
if (type)
- PRINT_PROC( "%02x\n", type == 0x0f ? nvram[12] : type );
+ PRINT_PROC("%02x\n", type == 0x0f ? nvram[12] : type);
else
- PRINT_PROC( "none\n" );
+ PRINT_PROC("none\n");
+
+ PRINT_PROC("HD type 48 data: %d/%d/%d C/H/S, precomp %d, lz %d\n",
+ nvram[18] | (nvram[19] << 8),
+ nvram[20], nvram[25],
+ nvram[21] | (nvram[22] << 8), nvram[23] | (nvram[24] << 8));
+ PRINT_PROC("HD type 49 data: %d/%d/%d C/H/S, precomp %d, lz %d\n",
+ nvram[39] | (nvram[40] << 8),
+ nvram[41], nvram[46],
+ nvram[42] | (nvram[43] << 8), nvram[44] | (nvram[45] << 8));
+
+ PRINT_PROC("DOS base memory: %d kB\n", nvram[7] | (nvram[8] << 8));
+ PRINT_PROC("Extended memory: %d kB (configured), %d kB (tested)\n",
+ nvram[9] | (nvram[10] << 8), nvram[34] | (nvram[35] << 8));
- PRINT_PROC( "HD type 48 data: %d/%d/%d C/H/S, precomp %d, lz %d\n",
- nvram[18] | (nvram[19] << 8),
- nvram[20], nvram[25],
- nvram[21] | (nvram[22] << 8),
- nvram[23] | (nvram[24] << 8) );
- PRINT_PROC( "HD type 49 data: %d/%d/%d C/H/S, precomp %d, lz %d\n",
- nvram[39] | (nvram[40] << 8),
- nvram[41], nvram[46],
- nvram[42] | (nvram[43] << 8),
- nvram[44] | (nvram[45] << 8) );
-
- PRINT_PROC( "DOS base memory: %d kB\n", nvram[7] | (nvram[8] << 8) );
- PRINT_PROC( "Extended memory: %d kB (configured), %d kB (tested)\n",
- nvram[9] | (nvram[10] << 8),
- nvram[34] | (nvram[35] << 8) );
-
- PRINT_PROC( "Gfx adapter : %s\n", gfx_types[ (nvram[6] >> 4)&3 ] );
-
- PRINT_PROC( "FPU : %sinstalled\n",
- (nvram[6] & 2) ? "" : "not " );
-
- return( 1 );
+ PRINT_PROC("Gfx adapter : %s\n", gfx_types[(nvram[6] >> 4) & 3]);
+
+ PRINT_PROC("FPU : %sinstalled\n",
+ (nvram[6] & 2) ? "" : "not ");
+
+ return 1;
}
#endif
@@ -571,26 +585,28 @@
#if MACH == ATARI
-static int atari_check_checksum( void )
+static int
+atari_check_checksum(void)
{
int i;
unsigned char sum = 0;
-
- for( i = ATARI_CKS_RANGE_START; i <= ATARI_CKS_RANGE_END; ++i )
- sum += nvram_read_int( i );
- return( nvram_read_int( ATARI_CKS_LOC ) == (~sum & 0xff) &&
- nvram_read_int( ATARI_CKS_LOC+1 ) == (sum & 0xff) );
+
+ for (i = ATARI_CKS_RANGE_START; i <= ATARI_CKS_RANGE_END; ++i)
+ sum += nvram_read_int(i);
+ return (nvram_read_int(ATARI_CKS_LOC) == (~sum & 0xff) &&
+ nvram_read_int(ATARI_CKS_LOC + 1) == (sum & 0xff));
}
-static void atari_set_checksum( void )
+static void
+atari_set_checksum(void)
{
int i;
unsigned char sum = 0;
-
- for( i = ATARI_CKS_RANGE_START; i <= ATARI_CKS_RANGE_END; ++i )
- sum += nvram_read_int( i );
- nvram_write_int( ~sum, ATARI_CKS_LOC );
- nvram_write_int( sum, ATARI_CKS_LOC+1 );
+
+ for (i = ATARI_CKS_RANGE_START; i <= ATARI_CKS_RANGE_END; ++i)
+ sum += nvram_read_int(i);
+ nvram_write_int(~sum, ATARI_CKS_LOC);
+ nvram_write_int(sum, ATARI_CKS_LOC + 1);
}
#ifdef CONFIG_PROC_FS
@@ -635,81 +651,74 @@
#define fieldsize(a) (sizeof(a)/sizeof(*a))
-static int atari_proc_infos( unsigned char *nvram, char *buffer, int *len,
- off_t *begin, off_t offset, int size )
+static int
+atari_proc_infos(unsigned char *nvram, char *buffer, int *len,
+ off_t *begin, off_t offset, int size)
{
int checksum = nvram_check_checksum();
int i;
unsigned vmode;
-
- PRINT_PROC( "Checksum status : %svalid\n", checksum ? "" : "not " );
- PRINT_PROC( "Boot preference : " );
- for( i = fieldsize(boot_prefs)-1; i >= 0; --i ) {
+ PRINT_PROC("Checksum status : %svalid\n", checksum ? "" : "not ");
+
+ PRINT_PROC("Boot preference : ");
+ for (i = fieldsize(boot_prefs) - 1; i >= 0; --i) {
if (nvram[1] == boot_prefs[i].val) {
- PRINT_PROC( "%s\n", boot_prefs[i].name );
+ PRINT_PROC("%s\n", boot_prefs[i].name);
break;
}
}
if (i < 0)
- PRINT_PROC( "0x%02x (undefined)\n", nvram[1] );
+ PRINT_PROC("0x%02x (undefined)\n", nvram[1]);
- PRINT_PROC( "SCSI arbitration : %s\n", (nvram[16] & 0x80) ? "on" : "off" );
- PRINT_PROC( "SCSI host ID : " );
+ PRINT_PROC("SCSI arbitration : %s\n",
+ (nvram[16] & 0x80) ? "on" : "off");
+ PRINT_PROC("SCSI host ID : ");
if (nvram[16] & 0x80)
- PRINT_PROC( "%d\n", nvram[16] & 7 );
+ PRINT_PROC("%d\n", nvram[16] & 7);
else
- PRINT_PROC( "n/a\n" );
+ PRINT_PROC("n/a\n");
/* the following entries are defined only for the Falcon */
if ((atari_mch_cookie >> 16) != ATARI_MCH_FALCON)
return 1;
- PRINT_PROC( "OS language : " );
+ PRINT_PROC("OS language : ");
if (nvram[6] < fieldsize(languages))
- PRINT_PROC( "%s\n", languages[nvram[6]] );
+ PRINT_PROC("%s\n", languages[nvram[6]]);
else
- PRINT_PROC( "%u (undefined)\n", nvram[6] );
- PRINT_PROC( "Keyboard language: " );
+ PRINT_PROC("%u (undefined)\n", nvram[6]);
+ PRINT_PROC("Keyboard language: ");
if (nvram[7] < fieldsize(languages))
- PRINT_PROC( "%s\n", languages[nvram[7]] );
+ PRINT_PROC("%s\n", languages[nvram[7]]);
else
- PRINT_PROC( "%u (undefined)\n", nvram[7] );
- PRINT_PROC( "Date format : " );
- PRINT_PROC( dateformat[nvram[8]&7],
- nvram[9] ? nvram[9] : '/', nvram[9] ? nvram[9] : '/' );
- PRINT_PROC( ", %dh clock\n", nvram[8] & 16 ? 24 : 12 );
- PRINT_PROC( "Boot delay : " );
+ PRINT_PROC("%u (undefined)\n", nvram[7]);
+ PRINT_PROC("Date format : ");
+ PRINT_PROC(dateformat[nvram[8] & 7],
+ nvram[9] ? nvram[9] : '/', nvram[9] ? nvram[9] : '/');
+ PRINT_PROC(", %dh clock\n", nvram[8] & 16 ? 24 : 12);
+ PRINT_PROC("Boot delay : ");
if (nvram[10] == 0)
- PRINT_PROC( "default" );
+ PRINT_PROC("default");
else
- PRINT_PROC( "%ds%s\n", nvram[10],
- nvram[10] < 8 ? ", no memory test" : "" );
+ PRINT_PROC("%ds%s\n", nvram[10],
+ nvram[10] < 8 ? ", no memory test" : "");
vmode = (nvram[14] << 8) || nvram[15];
- PRINT_PROC( "Video mode : %s colors, %d columns, %s %s monitor\n",
- colors[vmode & 7],
- vmode & 8 ? 80 : 40,
- vmode & 16 ? "VGA" : "TV",
- vmode & 32 ? "PAL" : "NTSC" );
- PRINT_PROC( " %soverscan, compat. mode %s%s\n",
- vmode & 64 ? "" : "no ",
- vmode & 128 ? "on" : "off",
- vmode & 256 ?
- (vmode & 16 ? ", line doubling" : ", half screen") : "" );
-
- return( 1 );
+ PRINT_PROC("Video mode : %s colors, %d columns, %s %s monitor\n",
+ colors[vmode & 7],
+ vmode & 8 ? 80 : 40,
+ vmode & 16 ? "VGA" : "TV", vmode & 32 ? "PAL" : "NTSC");
+ PRINT_PROC(" %soverscan, compat. mode %s%s\n",
+ vmode & 64 ? "" : "no ",
+ vmode & 128 ? "on" : "off",
+ vmode & 256 ?
+ (vmode & 16 ? ", line doubling" : ", half screen") : "");
+
+ return 1;
}
#endif
#endif /* MACH == ATARI */
MODULE_LICENSE("GPL");
-
-/*
- * Local variables:
- * c-indent-level: 4
- * tab-width: 4
- * End:
- */
-
diff -Nru a/drivers/char/ppdev.c b/drivers/char/ppdev.c
--- a/drivers/char/ppdev.c Thu Aug 1 14:17:40 2002
+++ b/drivers/char/ppdev.c Thu Aug 1 14:17:40 2002
@@ -749,7 +749,7 @@
static int __init ppdev_init (void)
{
- if (devfs_register_chrdev (PP_MAJOR, CHRDEV, &pp_fops)) {
+ if (register_chrdev (PP_MAJOR, CHRDEV, &pp_fops)) {
printk (KERN_WARNING CHRDEV ": unable to get major %d\n",
PP_MAJOR);
return -EIO;
@@ -768,7 +768,7 @@
{
/* Clean up all parport stuff */
devfs_unregister (devfs_handle);
- devfs_unregister_chrdev (PP_MAJOR, CHRDEV);
+ unregister_chrdev (PP_MAJOR, CHRDEV);
}
module_init(ppdev_init);
diff -Nru a/drivers/char/raw.c b/drivers/char/raw.c
--- a/drivers/char/raw.c Thu Aug 1 14:17:36 2002
+++ b/drivers/char/raw.c Thu Aug 1 14:17:36 2002
@@ -12,165 +12,106 @@
#include
#include
#include
+#include
#include
#include
-#include
-#include
-#define dprintk(x...)
+#include
-typedef struct raw_device_data_s {
+struct raw_device_data {
struct block_device *binding;
- int inuse, sector_size, sector_bits;
- struct semaphore mutex;
-} raw_device_data_t;
-
-static raw_device_data_t raw_devices[256];
-
-static ssize_t rw_raw_dev(int rw, struct file *, char *, size_t, loff_t *);
-
-ssize_t raw_read(struct file *, char *, size_t, loff_t *);
-ssize_t raw_write(struct file *, const char *, size_t, loff_t *);
-int raw_open(struct inode *, struct file *);
-int raw_release(struct inode *, struct file *);
-int raw_ctl_ioctl(struct inode *, struct file *, unsigned int, unsigned long);
-int raw_ioctl(struct inode *, struct file *, unsigned int, unsigned long);
-
-
-static struct file_operations raw_fops = {
- read: raw_read,
- write: raw_write,
- open: raw_open,
- release: raw_release,
- ioctl: raw_ioctl,
-};
-
-static struct file_operations raw_ctl_fops = {
- ioctl: raw_ctl_ioctl,
- open: raw_open,
+ int inuse;
};
-static int __init raw_init(void)
-{
- int i;
- register_chrdev(RAW_MAJOR, "raw", &raw_fops);
+static struct raw_device_data raw_devices[256];
+static DECLARE_MUTEX(raw_mutex);
+static struct file_operations raw_ctl_fops;
- for (i = 0; i < 256; i++)
- init_MUTEX(&raw_devices[i].mutex);
-
- return 0;
-}
-
-__initcall(raw_init);
-
-/*
+/*
* Open/close code for raw IO.
+ *
+ * Set the device's soft blocksize to the minimum possible. This gives the
+ * finest possible alignment and has no adverse impact on performance.
*/
-
-int raw_open(struct inode *inode, struct file *filp)
+static int raw_open(struct inode *inode, struct file *filp)
{
- int minor;
- struct block_device * bdev;
+ const int minor = minor(inode->i_rdev);
+ struct block_device *bdev;
int err;
- int sector_size;
- int sector_bits;
- minor = minor(inode->i_rdev);
-
- /*
- * Is it the control device?
- */
-
- if (minor == 0) {
+ if (minor == 0) { /* It is the control device */
filp->f_op = &raw_ctl_fops;
return 0;
}
- down(&raw_devices[minor].mutex);
+ down(&raw_mutex);
+
/*
- * No, it is a normal raw device. All we need to do on open is
- * to check that the device is bound, and force the underlying
- * block device to a sector-size blocksize.
+ * All we need to do on open is check that the device is bound.
*/
-
bdev = raw_devices[minor].binding;
err = -ENODEV;
- if (!bdev)
- goto out;
-
- atomic_inc(&bdev->bd_count);
- err = blkdev_get(bdev, filp->f_mode, 0, BDEV_RAW);
- if (err)
- goto out;
-
- /*
- * Don't change the blocksize if we already have users using
- * this device
- */
-
- if (raw_devices[minor].inuse++)
- goto out;
-
- sector_size = bdev_hardsect_size(bdev);
- raw_devices[minor].sector_size = sector_size;
- for (sector_bits = 0; !(sector_size & 1); )
- sector_size>>=1, sector_bits++;
- raw_devices[minor].sector_bits = sector_bits;
-
- out:
- up(&raw_devices[minor].mutex);
-
+ if (bdev) {
+ atomic_inc(&bdev->bd_count);
+ err = blkdev_get(bdev, filp->f_mode, 0, BDEV_RAW);
+ if (!err) {
+ err = set_blocksize(bdev, bdev_hardsect_size(bdev));
+ raw_devices[minor].inuse++;
+ }
+ }
+ up(&raw_mutex);
return err;
}
-int raw_release(struct inode *inode, struct file *filp)
+static int raw_release(struct inode *inode, struct file *filp)
{
- int minor;
+ const int minor= minor(inode->i_rdev);
struct block_device *bdev;
- minor = minor(inode->i_rdev);
- down(&raw_devices[minor].mutex);
+ down(&raw_mutex);
bdev = raw_devices[minor].binding;
raw_devices[minor].inuse--;
- up(&raw_devices[minor].mutex);
+ up(&raw_mutex);
blkdev_put(bdev, BDEV_RAW);
return 0;
}
-
-
-/* Forward ioctls to the underlying block device. */
-int raw_ioctl(struct inode *inode,
- struct file *flip,
- unsigned int command,
- unsigned long arg)
+/*
+ * Forward ioctls to the underlying block device.
+ */
+static int
+raw_ioctl(struct inode *inode, struct file *filp,
+ unsigned int command, unsigned long arg)
{
- int minor = minor(inode->i_rdev), err;
- struct block_device *b;
+ const int minor = minor(inode->i_rdev);
+ int err;
+ struct block_device *bdev;
+
+ err = -ENODEV;
if (minor < 1 && minor > 255)
- return -ENODEV;
+ goto out;
- b = raw_devices[minor].binding;
- err = -EINVAL;
- if (b && b->bd_inode && b->bd_op && b->bd_op->ioctl) {
- err = b->bd_op->ioctl(b->bd_inode, NULL, command, arg);
- }
+ bdev = raw_devices[minor].binding;
+ err = -EINVAL;
+ if (bdev == NULL)
+ goto out;
+ if (bdev->bd_inode && bdev->bd_op && bdev->bd_op->ioctl)
+ err = bdev->bd_op->ioctl(bdev->bd_inode, NULL, command, arg);
+out:
return err;
-}
+}
/*
* Deal with ioctls against the raw-device control interface, to bind
- * and unbind other raw devices.
+ * and unbind other raw devices.
*/
-
-int raw_ctl_ioctl(struct inode *inode,
- struct file *flip,
- unsigned int command,
- unsigned long arg)
+static int
+raw_ctl_ioctl(struct inode *inode, struct file *filp,
+ unsigned int command, unsigned long arg)
{
struct raw_config_request rq;
- int err = 0;
- int minor;
+ struct raw_device_data *rawdev;
+ int err;
switch (command) {
case RAW_SETBIND:
@@ -178,58 +119,64 @@
/* First, find out which raw minor we want */
- if (copy_from_user(&rq, (void *) arg, sizeof(rq))) {
- err = -EFAULT;
- break;
- }
+ err = -EFAULT;
+ if (copy_from_user(&rq, (void *) arg, sizeof(rq)))
+ goto out;
- minor = rq.raw_minor;
- if (minor <= 0 || minor > MINORMASK) {
- err = -EINVAL;
- break;
- }
+ err = -EINVAL;
+ if (rq.raw_minor < 0 || rq.raw_minor > MINORMASK)
+ goto out;
+ rawdev = &raw_devices[rq.raw_minor];
if (command == RAW_SETBIND) {
/*
* This is like making block devices, so demand the
* same capability
*/
- if (!capable(CAP_SYS_ADMIN)) {
- err = -EPERM;
- break;
- }
+ err = -EPERM;
+ if (!capable(CAP_SYS_ADMIN))
+ goto out;
- /*
+ /*
* For now, we don't need to check that the underlying
* block device is present or not: we can do that when
* the raw device is opened. Just check that the
- * major/minor numbers make sense.
+ * major/minor numbers make sense.
*/
- if ((rq.block_major == 0 &&
- rq.block_minor != 0) ||
- rq.block_major > MAX_BLKDEV ||
- rq.block_minor > MINORMASK) {
- err = -EINVAL;
- break;
- }
+ err = -EINVAL;
+ if ((rq.block_major == 0 && rq.block_minor != 0) ||
+ rq.block_major > MAX_BLKDEV ||
+ rq.block_minor > MINORMASK)
+ goto out;
- down(&raw_devices[minor].mutex);
- if (raw_devices[minor].inuse) {
- up(&raw_devices[minor].mutex);
- err = -EBUSY;
- break;
+ down(&raw_mutex);
+ err = -EBUSY;
+ if (rawdev->inuse) {
+ up(&raw_mutex);
+ goto out;
+ }
+ if (rawdev->binding) {
+ bdput(rawdev->binding);
+ MOD_DEC_USE_COUNT;
}
- if (raw_devices[minor].binding)
- bdput(raw_devices[minor].binding);
- raw_devices[minor].binding =
- bdget(kdev_t_to_nr(mk_kdev(rq.block_major, rq.block_minor)));
- up(&raw_devices[minor].mutex);
+ if (rq.block_major == 0 && rq.block_minor == 0) {
+ /* unbind */
+ rawdev->binding = NULL;
+ } else {
+ kdev_t kdev;
+
+ kdev = mk_kdev(rq.block_major, rq.block_minor);
+ rawdev->binding = bdget(kdev_t_to_nr(kdev));
+ MOD_INC_USE_COUNT;
+ }
+ up(&raw_mutex);
} else {
struct block_device *bdev;
kdev_t dev;
- bdev = raw_devices[minor].binding;
+ down(&raw_mutex);
+ bdev = rawdev->binding;
if (bdev) {
dev = to_kdev_t(bdev->bd_dev);
rq.block_major = major(dev);
@@ -237,59 +184,85 @@
} else {
rq.block_major = rq.block_minor = 0;
}
- err = copy_to_user((void *) arg, &rq, sizeof(rq));
- if (err)
- err = -EFAULT;
+ up(&raw_mutex);
+ err = -EFAULT;
+ if (copy_to_user((void *)arg, &rq, sizeof(rq)))
+ goto out;
}
+ err = 0;
break;
default:
err = -EINVAL;
+ break;
}
-
+out:
return err;
}
-ssize_t raw_read(struct file *filp, char * buf, size_t size, loff_t *offp)
-{
- return rw_raw_dev(READ, filp, buf, size, offp);
-}
-
-ssize_t raw_write(struct file *filp, const char *buf, size_t size, loff_t *offp)
-{
- return rw_raw_dev(WRITE, filp, (char *) buf, size, offp);
-}
-
-ssize_t
+static ssize_t
rw_raw_dev(int rw, struct file *filp, char *buf, size_t size, loff_t *offp)
{
- struct block_device *bdev;
- struct inode *inode;
- int minor;
+ const int minor = minor(filp->f_dentry->d_inode->i_rdev);
+ struct block_device *bdev = raw_devices[minor].binding;
+ struct inode *inode = bdev->bd_inode;
ssize_t ret = 0;
- minor = minor(filp->f_dentry->d_inode->i_rdev);
- bdev = raw_devices[minor].binding;
- inode = bdev->bd_inode;
-
if (size == 0)
goto out;
- if (size < 0) {
- ret = -EINVAL;
+ ret = -EINVAL;
+ if (size < 0)
goto out;
- }
- if (*offp >= inode->i_size) {
- ret = -ENXIO;
+ ret = -ENXIO;
+ if (*offp >= inode->i_size)
goto out;
- }
+
if (size + *offp > inode->i_size)
size = inode->i_size - *offp;
-
ret = generic_file_direct_IO(rw, inode, buf, *offp, size);
if (ret > 0)
*offp += ret;
- if (inode->i_mapping->nrpages)
- invalidate_inode_pages2(inode->i_mapping);
out:
return ret;
}
+
+static ssize_t
+raw_read(struct file *filp, char * buf, size_t size, loff_t *offp)
+{
+ return rw_raw_dev(READ, filp, buf, size, offp);
+}
+
+static ssize_t
+raw_write(struct file *filp, const char *buf, size_t size, loff_t *offp)
+{
+ return rw_raw_dev(WRITE, filp, (char *)buf, size, offp);
+}
+
+static struct file_operations raw_fops = {
+ .read = raw_read,
+ .write = raw_write,
+ .open = raw_open,
+ .release= raw_release,
+ .ioctl = raw_ioctl,
+ .owner = THIS_MODULE,
+};
+
+static struct file_operations raw_ctl_fops = {
+ .ioctl = raw_ctl_ioctl,
+ .open = raw_open,
+ .owner = THIS_MODULE,
+};
+
+static int __init raw_init(void)
+{
+ register_chrdev(RAW_MAJOR, "raw", &raw_fops);
+ return 0;
+}
+
+static void __exit raw_exit(void)
+{
+ unregister_chrdev(RAW_MAJOR, "raw");
+}
+
+module_init(raw_init);
+module_exit(raw_exit);
diff -Nru a/drivers/char/rocket.c b/drivers/char/rocket.c
--- a/drivers/char/rocket.c Thu Aug 1 14:17:36 2002
+++ b/drivers/char/rocket.c Thu Aug 1 14:17:36 2002
@@ -1881,15 +1881,23 @@
{
int num_aiops, num_chan;
int aiop, chan;
+ int extent = 0;
unsigned int aiopio[MAX_AIOPS_PER_BOARD];
CONTROLLER_t *ctlp;
if (rcktpt_io_addr[i] == 0)
return(0);
- if (check_region(rcktpt_io_addr[i],64)) {
+ if (rcktpt_io_addr[i] + 0x40 == controller) {
+ *reserved_controller = 1;
+ extent = 68;
+ } else {
+ extent = 64;
+ }
+ if (!request_region(rcktpt_io_addr[i], extent,
+ "Comtrol Rocketport")) {
printk("RocketPort board address 0x%lx in use...\n",
- rcktpt_io_addr[i]);
+ rcktpt_io_addr[i]);
rcktpt_io_addr[i] = 0;
return(0);
}
@@ -1901,6 +1909,7 @@
aiopio, MAX_AIOPS_PER_BOARD, 0,
FREQ_DIS, 0);
if (num_aiops <= 0) {
+ release_region(rcktpt_io_addr[i], extent);
rcktpt_io_addr[i] = 0;
return(0);
}
@@ -1914,14 +1923,6 @@
printk("Rocketport controller #%d found at 0x%lx, "
"%d AIOPs\n", i, rcktpt_io_addr[i],
num_aiops);
- if (rcktpt_io_addr[i] + 0x40 == controller) {
- *reserved_controller = 1;
- request_region(rcktpt_io_addr[i], 68,
- "Comtrol Rocketport");
- } else {
- request_region(rcktpt_io_addr[i], 64,
- "Comtrol Rocketport");
- }
return(1);
}
diff -Nru a/drivers/char/stallion.c b/drivers/char/stallion.c
--- a/drivers/char/stallion.c Thu Aug 1 14:17:37 2002
+++ b/drivers/char/stallion.c Thu Aug 1 14:17:37 2002
@@ -810,7 +810,7 @@
return;
}
devfs_unregister (devfs_handle);
- if ((i = devfs_unregister_chrdev(STL_SIOMEMMAJOR, "staliomem")))
+ if ((i = unregister_chrdev(STL_SIOMEMMAJOR, "staliomem")))
printk("STALLION: failed to un-register serial memory device, "
"errno=%d\n", -i);
@@ -3208,7 +3208,7 @@
* Set up a character driver for per board stuff. This is mainly used
* to do stats ioctls on the ports.
*/
- if (devfs_register_chrdev(STL_SIOMEMMAJOR, "staliomem", &stl_fsiomem))
+ if (register_chrdev(STL_SIOMEMMAJOR, "staliomem", &stl_fsiomem))
printk("STALLION: failed to register serial board device\n");
devfs_handle = devfs_mk_dir (NULL, "staliomem", NULL);
devfs_register_series (devfs_handle, "%u", 4, DEVFS_FL_DEFAULT,
diff -Nru a/drivers/char/tpqic02.c b/drivers/char/tpqic02.c
--- a/drivers/char/tpqic02.c Thu Aug 1 14:17:40 2002
+++ b/drivers/char/tpqic02.c Thu Aug 1 14:17:40 2002
@@ -2846,7 +2846,7 @@
#endif
printk(TPQIC02_NAME ": DMA buffers: %u blocks\n", NR_BLK_BUF);
/* If we got this far, install driver functions */
- if (devfs_register_chrdev
+ if (register_chrdev
(QIC02_TAPE_MAJOR, TPQIC02_NAME, &qic02_tape_fops)) {
printk(TPQIC02_NAME ": Unable to get chrdev major %d\n",
QIC02_TAPE_MAJOR);
@@ -2930,31 +2930,23 @@
if (status_zombie == NO) {
qic02_release_resources();
}
- devfs_unregister_chrdev(QIC02_TAPE_MAJOR, TPQIC02_NAME);
- devfs_unregister(devfs_find_handle
- (NULL, "ntpqic11", QIC02_TAPE_MAJOR, 2,
- DEVFS_SPECIAL_CHR, 0));
- devfs_unregister(devfs_find_handle
- (NULL, "tpqic11", QIC02_TAPE_MAJOR, 3,
- DEVFS_SPECIAL_CHR, 0));
- devfs_unregister(devfs_find_handle
- (NULL, "ntpqic24", QIC02_TAPE_MAJOR, 4,
- DEVFS_SPECIAL_CHR, 0));
- devfs_unregister(devfs_find_handle
- (NULL, "tpqic24", QIC02_TAPE_MAJOR, 5,
- DEVFS_SPECIAL_CHR, 0));
- devfs_unregister(devfs_find_handle
- (NULL, "ntpqic120", QIC02_TAPE_MAJOR, 6,
- DEVFS_SPECIAL_CHR, 0));
- devfs_unregister(devfs_find_handle
- (NULL, "tpqic120", QIC02_TAPE_MAJOR, 7,
- DEVFS_SPECIAL_CHR, 0));
- devfs_unregister(devfs_find_handle
- (NULL, "ntpqic150", QIC02_TAPE_MAJOR, 8,
- DEVFS_SPECIAL_CHR, 0));
- devfs_unregister(devfs_find_handle
- (NULL, "tpqic150", QIC02_TAPE_MAJOR, 9,
- DEVFS_SPECIAL_CHR, 0));
+ unregister_chrdev(QIC02_TAPE_MAJOR, TPQIC02_NAME);
+ devfs_find_and_unregister(NULL, "ntpqic11", QIC02_TAPE_MAJOR, 2,
+ DEVFS_SPECIAL_CHR, 0);
+ devfs_find_and_unregister(NULL, "tpqic11", QIC02_TAPE_MAJOR, 3,
+ DEVFS_SPECIAL_CHR, 0);
+ devfs_find_and_unregister(NULL, "ntpqic24", QIC02_TAPE_MAJOR, 4,
+ DEVFS_SPECIAL_CHR, 0);
+ devfs_find_and_unregister(NULL, "tpqic24", QIC02_TAPE_MAJOR, 5,
+ DEVFS_SPECIAL_CHR, 0);
+ devfs_find_and_unregister(NULL, "ntpqic120", QIC02_TAPE_MAJOR, 6,
+ DEVFS_SPECIAL_CHR, 0);
+ devfs_find_and_unregister(NULL, "tpqic120", QIC02_TAPE_MAJOR, 7,
+ DEVFS_SPECIAL_CHR, 0);
+ devfs_find_and_unregister(NULL, "ntpqic150", QIC02_TAPE_MAJOR, 8,
+ DEVFS_SPECIAL_CHR, 0);
+ devfs_find_and_unregister(NULL, "tpqic150", QIC02_TAPE_MAJOR, 9,
+ DEVFS_SPECIAL_CHR, 0);
}
int init_module(void)
diff -Nru a/drivers/char/tty_io.c b/drivers/char/tty_io.c
--- a/drivers/char/tty_io.c Thu Aug 1 14:17:40 2002
+++ b/drivers/char/tty_io.c Thu Aug 1 14:17:40 2002
@@ -2047,14 +2047,12 @@
void tty_unregister_devfs (struct tty_driver *driver, unsigned minor)
{
#ifdef CONFIG_DEVFS_FS
- void * handle;
int idx = minor - driver->minor_start;
char buf[32];
sprintf(buf, driver->name, idx + driver->name_base);
- handle = devfs_find_handle (NULL, buf, driver->major, minor,
- DEVFS_SPECIAL_CHR, 0);
- devfs_unregister (handle);
+ devfs_find_and_unregister(NULL, buf, driver->major, minor,
+ DEVFS_SPECIAL_CHR, 0);
#endif /* CONFIG_DEVFS_FS */
}
@@ -2072,7 +2070,7 @@
if (driver->flags & TTY_DRIVER_INSTALLED)
return 0;
- error = devfs_register_chrdev(driver->major, driver->name, &tty_fops);
+ error = register_chrdev(driver->major, driver->name, &tty_fops);
if (error < 0)
return error;
else if(driver->major == 0)
@@ -2119,11 +2117,11 @@
return -ENOENT;
if (othername == NULL) {
- retval = devfs_unregister_chrdev(driver->major, driver->name);
+ retval = unregister_chrdev(driver->major, driver->name);
if (retval)
return retval;
} else
- devfs_register_chrdev(driver->major, othername, &tty_fops);
+ register_chrdev(driver->major, othername, &tty_fops);
if (driver->prev)
driver->prev->next = driver->next;
diff -Nru a/drivers/char/vc_screen.c b/drivers/char/vc_screen.c
--- a/drivers/char/vc_screen.c Thu Aug 1 14:17:39 2002
+++ b/drivers/char/vc_screen.c Thu Aug 1 14:17:39 2002
@@ -480,10 +480,10 @@
sprintf (name, "a%u", index + 1);
if (unregister)
{
- devfs_unregister ( devfs_find_handle (devfs_handle, name + 1, 0, 0,
- DEVFS_SPECIAL_CHR, 0) );
- devfs_unregister ( devfs_find_handle (devfs_handle, name, 0, 0,
- DEVFS_SPECIAL_CHR, 0) );
+ devfs_find_and_unregister(devfs_handle, name + 1, 0, 0,
+ DEVFS_SPECIAL_CHR, 0);
+ devfs_find_and_unregister(devfs_handle, name, 0, 0,
+ DEVFS_SPECIAL_CHR, 0);
}
else
{
@@ -501,7 +501,7 @@
{
int error;
- error = devfs_register_chrdev(VCS_MAJOR, "vcs", &vcs_fops);
+ error = register_chrdev(VCS_MAJOR, "vcs", &vcs_fops);
if (error)
printk("unable to get major %d for vcs device", VCS_MAJOR);
diff -Nru a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c
--- a/drivers/i2c/i2c-dev.c Thu Aug 1 14:17:41 2002
+++ b/drivers/i2c/i2c-dev.c Thu Aug 1 14:17:41 2002
@@ -489,11 +489,7 @@
printk(KERN_INFO "i2c-dev.o: i2c /dev entries driver module version %s (%s)\n", I2C_VERSION, I2C_DATE);
i2cdev_initialized = 0;
-#ifdef CONFIG_DEVFS_FS
- if (devfs_register_chrdev(I2C_MAJOR, "i2c", &i2cdev_fops)) {
-#else
if (register_chrdev(I2C_MAJOR,"i2c",&i2cdev_fops)) {
-#endif
printk(KERN_ERR "i2c-dev.o: unable to get major %d for i2c bus\n",
I2C_MAJOR);
return -EIO;
@@ -528,10 +524,8 @@
if (i2cdev_initialized >= 1) {
#ifdef CONFIG_DEVFS_FS
devfs_unregister(devfs_handle);
- if ((res = devfs_unregister_chrdev(I2C_MAJOR, "i2c"))) {
-#else
- if ((res = unregister_chrdev(I2C_MAJOR,"i2c"))) {
#endif
+ if ((res = unregister_chrdev(I2C_MAJOR,"i2c"))) {
printk(KERN_ERR "i2c-dev.o: unable to release major %d for i2c bus\n",
I2C_MAJOR);
return res;
diff -Nru a/drivers/ide/ali14xx.c b/drivers/ide/ali14xx.c
--- a/drivers/ide/ali14xx.c Thu Aug 1 14:17:40 2002
+++ b/drivers/ide/ali14xx.c Thu Aug 1 14:17:40 2002
@@ -107,13 +107,14 @@
* Set PIO mode for the specified drive.
* This function computes timing parameters
* and sets controller registers accordingly.
+ * It assumes IRQ's are disabled or at least that no other process will
+ * attempt to access the IDE registers concurrently.
*/
static void ali14xx_tune_drive(struct ata_device *drive, u8 pio)
{
int drive_num;
int time1, time2;
u8 param1, param2, param3, param4;
- unsigned long flags;
struct ata_timing *t;
if (pio == 255)
@@ -140,15 +141,12 @@
/* stuff timing parameters into controller registers */
drive_num = (drive->channel->index << 1) + drive->select.b.unit;
- save_flags(flags); /* all CPUs */
- cli(); /* all CPUs */
outb_p(reg_on, base_port);
out_reg(param1, reg_tab[drive_num].reg1);
out_reg(param2, reg_tab[drive_num].reg2);
out_reg(param3, reg_tab[drive_num].reg3);
out_reg(param4, reg_tab[drive_num].reg4);
outb_p(reg_off, base_port);
- restore_flags(flags); /* all CPUs */
}
/*
diff -Nru a/drivers/ide/ataraid.c b/drivers/ide/ataraid.c
--- a/drivers/ide/ataraid.c Thu Aug 1 14:17:40 2002
+++ b/drivers/ide/ataraid.c Thu Aug 1 14:17:40 2002
@@ -45,7 +45,6 @@
struct gendisk ataraid_gendisk;
-static int ataraid_gendisk_sizes[256];
static int ataraid_readahead[256];
static struct block_device_operations ataraid_fops = {
@@ -257,7 +256,6 @@
ataraid_gendisk.major = ATAMAJOR;
ataraid_gendisk.major_name = "ataraid";
ataraid_gendisk.minor_shift = 4;
- ataraid_gendisk.sizes = &ataraid_gendisk_sizes[0];
ataraid_gendisk.nr_real = 16;
ataraid_gendisk.fops = &ataraid_fops;
@@ -282,7 +280,6 @@
static void __exit ataraid_exit(void)
{
unregister_blkdev(ATAMAJOR, "ataraid");
- blk_size[ATAMAJOR] = NULL;
del_gendisk(&ataraid_gendisk);
diff -Nru a/drivers/ide/cmd640.c b/drivers/ide/cmd640.c
--- a/drivers/ide/cmd640.c Thu Aug 1 14:17:40 2002
+++ b/drivers/ide/cmd640.c Thu Aug 1 14:17:40 2002
@@ -109,6 +109,7 @@
#include
#include