Commit 9c1069bc authored by Linus Torvalds's avatar Linus Torvalds

Import 1.1.71

parent 00c2e5a7
...@@ -43,18 +43,6 @@ function readln () { ...@@ -43,18 +43,6 @@ function readln () {
fi fi
} }
#
# change updates the "config.new" file according to the answer
#
# change define old new
#
function change () {
if [ "$2" != "$3" ]; then
sed "s/$1 $2$/$1 $3/" < $CONFIG_NEW > .tmpc
mv .tmpc $CONFIG_NEW
fi
}
# #
# comment does some pretty-printing # comment does some pretty-printing
# #
...@@ -73,17 +61,17 @@ function comment () { ...@@ -73,17 +61,17 @@ function comment () {
# #
function bool () { function bool () {
ans="" ans=""
def=$(eval echo "\${$2:-$3}")
while [ "$ans" != "y" -a "$ans" != "n" ]; do while [ "$ans" != "y" -a "$ans" != "n" ]; do
readln "$1 ($2) [$3] " "$3" readln "$1 ($2) [$def] " "$def"
done done
if [ "$ans" = "y" ]; then if [ "$ans" = "y" ]; then
echo " $2 = $2" >>$CONFIG echo "$2=y" >>$CONFIG
echo "#define $2 1" >>$CONFIG_H echo "#define $2 1" >>$CONFIG_H
else else
echo "# $2 is not set" >>$CONFIG echo "# $2 is not set" >>$CONFIG
echo "#undef $2" >>$CONFIG_H echo "#undef $2" >>$CONFIG_H
fi fi
change $2 $3 $ans
eval "$2=$ans" eval "$2=$ans"
} }
...@@ -95,23 +83,22 @@ function bool () { ...@@ -95,23 +83,22 @@ function bool () {
function int () { function int () {
# Slimier hack to get bash to rescan a line. # Slimier hack to get bash to rescan a line.
ans="x" ans="x"
def=$(eval echo "\${$2:-$3}")
while [ $[$ans+0] != "$ans" ]; do while [ $[$ans+0] != "$ans" ]; do
readln "$1 ($2) [$3] " "$3" readln "$1 ($2) [$def] " "$def"
done done
echo " $2 = $ans" >>$CONFIG echo "$2=$ans" >>$CONFIG
echo "#define $2 ($ans)" >>$CONFIG_H echo "#define $2 ($ans)" >>$CONFIG_H
eval "$2=$ans" eval "$2=$ans"
} }
CONFIG=.tmpconfig CONFIG=.tmpconfig
CONFIG_H=.tmpconfig.h CONFIG_H=.tmpconfig.h
CONFIG_NEW=config.new trap "rm -f $CONFIG $CONFIG_H ; exit 1" 1 2
trap "rm -f $CONFIG $CONFIG_H $CONFIG_NEW ; exit 1" 1 2
# #
# Make sure we start out with a clean slate. # Make sure we start out with a clean slate.
# #
cp config.in $CONFIG_NEW
echo "#" > $CONFIG echo "#" > $CONFIG
echo "# Automatically generated make config: don't edit" >> $CONFIG echo "# Automatically generated make config: don't edit" >> $CONFIG
echo "#" >> $CONFIG echo "#" >> $CONFIG
...@@ -122,16 +109,24 @@ echo " */" >> $CONFIG_H ...@@ -122,16 +109,24 @@ echo " */" >> $CONFIG_H
DEFAULT=$1 DEFAULT=$1
if [ -f ./.config ] ; then
. ./.config
sed -e 's/# \(.*\) is not.*/\1=n/' <./.config >/tmp/conf.$$
. /tmp/conf.$$
rm /tmp/conf.$$
fi
. ./config.in . ./config.in
if [ "$CONFIG_SOUND" = "y" ] ; then if [ "$CONFIG_SOUND" = "y" ] ; then
$MAKE -C drivers/sound config || exit 1 $MAKE -C drivers/sound config || exit 1
fi fi
rm -f .config.old
if [ -f .config ]; then
mv .config .config.old
fi
mv .tmpconfig .config mv .tmpconfig .config
mv .tmpconfig.h include/linux/autoconf.h mv .tmpconfig.h include/linux/autoconf.h
mv config.in config.old
mv config.new config.in
echo echo
echo "The linux kernel is now hopefully configured for your setup." echo "The linux kernel is now hopefully configured for your setup."
......
VERSION = 1 VERSION = 1
PATCHLEVEL = 1 PATCHLEVEL = 1
SUBLEVEL = 70 SUBLEVEL = 71
ARCH = i386 ARCH = i386
......
...@@ -95,8 +95,6 @@ startup_32: ...@@ -95,8 +95,6 @@ startup_32:
* apply at our cpl of 0 and the stack ought to be aligned already, and * apply at our cpl of 0 and the stack ought to be aligned already, and
* we don't need to preserve eflags. * we don't need to preserve eflags.
*/ */
movl %esp,%edi # save stack pointer
andl $0xfffffffc,%esp # align stack to avoid AC fault
movl $3,_x86 movl $3,_x86
pushfl # push EFLAGS pushfl # push EFLAGS
popl %eax # get EFLAGS popl %eax # get EFLAGS
...@@ -121,26 +119,31 @@ startup_32: ...@@ -121,26 +119,31 @@ startup_32:
je is486 je is486
isnew: pushl %ecx # restore original EFLAGS isnew: pushl %ecx # restore original EFLAGS
popfl popfl
/* get processor type */
movl $1, %eax # Use the CPUID instruction to movl $1, %eax # Use the CPUID instruction to
.byte 0x0f, 0xa2 # check the processor type .byte 0x0f, 0xa2 # check the processor type
andl $0xf00, %eax # Set _x86 with the family andl $0xf00, %eax # Set _x86 with the family
shrl $8, %eax # returned. shrl $8, %eax # returned.
movl %eax, _x86 movl %eax, _x86
movl %edi,%esp # restore esp /* get vendor info */
xorl %eax, %eax # call CPUID with 0 -> return vendor ID
.byte 0x0f, 0xa2 # CPUID
movl %ebx, _x86_vendor_id # lo 4 chars
movl %edx, _x86_vendor_id+4 # next 4 chars
movl %ecx, _x86_vendor_id+8 # last 4 chars
movl %cr0,%eax # 486+ movl %cr0,%eax # 486+
andl $0x80000011,%eax # Save PG,PE,ET andl $0x80000011,%eax # Save PG,PE,ET
orl $0x50022,%eax # set AM, WP, NE and MP orl $0x50022,%eax # set AM, WP, NE and MP
jmp 2f jmp 2f
is486: pushl %ecx # restore original EFLAGS is486: pushl %ecx # restore original EFLAGS
popfl popfl
movl %edi,%esp # restore esp
movl %cr0,%eax # 486 movl %cr0,%eax # 486
andl $0x80000011,%eax # Save PG,PE,ET andl $0x80000011,%eax # Save PG,PE,ET
orl $0x50022,%eax # set AM, WP, NE and MP orl $0x50022,%eax # set AM, WP, NE and MP
jmp 2f jmp 2f
is386: pushl %ecx # restore original EFLAGS is386: pushl %ecx # restore original EFLAGS
popfl popfl
movl %edi,%esp # restore esp
movl %cr0,%eax # 386 movl %cr0,%eax # 386
andl $0x80000011,%eax # Save PG,PE,ET andl $0x80000011,%eax # Save PG,PE,ET
orl $2,%eax # set MP orl $2,%eax # set MP
......
...@@ -31,9 +31,9 @@ comment 'Networking options' ...@@ -31,9 +31,9 @@ comment 'Networking options'
bool 'TCP/IP networking' CONFIG_INET y bool 'TCP/IP networking' CONFIG_INET y
if [ "$CONFIG_INET" "=" "y" ]; then if [ "$CONFIG_INET" "=" "y" ]; then
bool 'IP forwarding/gatewaying' CONFIG_IP_FORWARD n bool 'IP forwarding/gatewaying' CONFIG_IP_FORWARD n
#bool 'IP multicasting (ALPHA)' CONFIG_IP_MULTICAST n bool 'IP multicasting (ALPHA)' CONFIG_IP_MULTICAST n
#bool 'IP firewalling' CONFIG_IP_FIREWALL n bool 'IP firewalling' CONFIG_IP_FIREWALL n
#bool 'IP accounting' CONFIG_IP_ACCT n bool 'IP accounting' CONFIG_IP_ACCT n
comment '(it is safe to leave these untouched)' comment '(it is safe to leave these untouched)'
bool 'PC/TCP compatibility mode' CONFIG_INET_PCTCP n bool 'PC/TCP compatibility mode' CONFIG_INET_PCTCP n
bool 'Reverse ARP' CONFIG_INET_RARP n bool 'Reverse ARP' CONFIG_INET_RARP n
...@@ -100,6 +100,7 @@ bool 'Dummy net driver support' CONFIG_DUMMY n ...@@ -100,6 +100,7 @@ bool 'Dummy net driver support' CONFIG_DUMMY n
bool 'SLIP (serial line) support' CONFIG_SLIP n bool 'SLIP (serial line) support' CONFIG_SLIP n
if [ "$CONFIG_SLIP" = "y" ]; then if [ "$CONFIG_SLIP" = "y" ]; then
bool ' CSLIP compressed headers' SL_COMPRESSED y bool ' CSLIP compressed headers' SL_COMPRESSED y
bool ' 16 channels instead of 4' SL_SLIP_LOTS n
# bool ' SLIP debugging on' SL_DUMP y # bool ' SLIP debugging on' SL_DUMP y
fi fi
bool 'PPP (point-to-point) support' CONFIG_PPP n bool 'PPP (point-to-point) support' CONFIG_PPP n
...@@ -112,9 +113,6 @@ if [ "$CONFIG_NET_VENDOR_SMC" = "y" ]; then ...@@ -112,9 +113,6 @@ if [ "$CONFIG_NET_VENDOR_SMC" = "y" ]; then
bool 'SMC Ultra support' CONFIG_ULTRA n bool 'SMC Ultra support' CONFIG_ULTRA n
fi fi
bool 'AMD LANCE and PCnet (AT1500 and NE2100) support' CONFIG_LANCE n bool 'AMD LANCE and PCnet (AT1500 and NE2100) support' CONFIG_LANCE n
if [ "$CONFIG_LANCE" = "y" ]; then
bool ' with PCnet/PCI support' CONFIG_PCI y
fi
bool '3COM cards' CONFIG_NET_VENDOR_3COM y bool '3COM cards' CONFIG_NET_VENDOR_3COM y
if [ "$CONFIG_NET_VENDOR_3COM" = "y" ]; then if [ "$CONFIG_NET_VENDOR_3COM" = "y" ]; then
bool '3c501 support' CONFIG_EL1 n bool '3c501 support' CONFIG_EL1 n
......
#include "boot.h"
#include "version.h"
.data
/* First thing to go in the data segment is the interrupt stack */
.globl _intstack
.globl _eintstack
_intstack:
.skip 4 * NBPG ! 16k = 128 128-byte stack frames
_eintstack:
/*
The following are used with the prom_vector node-ops to figure out
the cpu-type
*/
.globl _cputyp
_cputyp:
.word 1
_cputypval:
.asciz "sun4c"
.ascii " "
_cputypvar:
.asciz "compatability"
_cputypvallen = _cputypvar - _cputypval
/* WARNING: evil messages follow */
.align 4
sun4_notsup:
.asciz "Sparc-Linux: sun4 support not implemented yet\n\n"
.align 4
sun4m_notsup:
.asciz "Sparc-Linux: sun4m support does not exist\n\n"
.align 4
sun4d_notsup:
.asciz "Sparc-Linux: sun4d support does not exist\n\n"
.align 4
/* The following will disappear real soon as the implementation is easy */
v2_prom_notyet:
.asciz "Sparc-Linux: v2 boot-prom support not implemented\n\n"
.align 4
/*
Fill up the prom vector, note in particular the kind first element,
no joke.
*/
.globl _prom_vector_p
_prom_vector_p: .skip 4
prom_magic: .skip 4 ! magic mushroom, beware...
prom_rom_vers: .skip 4 ! interface version (v0 or v2)
prom_pluginvers: .skip 4 ! XXX help help help
prom_revision: .skip 4 ! PROM revision (ie. 1.4)
prom_bootstr: .skip 4 ! what we are invoked with
prom_putchar: .skip 4 ! void putchar(int ch) BLOCKING.
prom_getchar: .skip 4 ! int getchar(void) BLOCKING.
prom_nputchar: .skip 4 ! int purchar(int ch) non-block
prom_ngetchar: .skip 4 ! int getchar(void) non-block
prom_halt: .skip 4 ! void halt(void) solaris friend
prom_eval: .skip 4 ! void eval(int len, char* string)
prom_v0mem_desc: .skip 4 ! V0 memory descriptor list ptr.
prom_nodefuncs: .skip 4 ! Magical Node functions
prom_v0devfuncs: .skip 4 ! V0 device operations
prom_putstring: .skip 4 ! prom putstring()
prom_bootme: .skip 4 ! reset()
prom_printf: .skip 4 ! minimal printf()
prom_abort: .skip 4 ! "L1-A" magic cookie
! must be mapped in ALL contexts
prom_ticks: .skip 4 ! number of ticks since reset
prom_sync: .skip 4 ! hook in prom for "sync" func
prom_v0bootarg: .skip 4 ! v0 prom boot arguements
prom_v2bootarg: .skip 4 ! same as above for v2 proms
prom_ethaddr_func: .skip 4 ! extract ethernet device address
prom_v2devfunc: .skip 4 ! ptr to v2 style device ops.
prom_xtra_array: .skip 4 ! who knows :-( help help
prom_setcontext: .skip 4 ! set context on sun4c
prom_stdin: .skip 4 ! prom stdin magic cookie
prom_stdout: .skip 4 ! prom stdout magic cookie
.align 4
.globl boot_msg
/*
This gets forth eval'd, just 'cause I think forth is neat to have in a boot
monitor :-) We may not need no steenkin BIOS but we do need the prom!
*/
boot_msg:
.ascii "Booting Sparc-Linux V0.00PRE-ALPHA (SUN4C) "
.ascii WHO_COMPILED_ME
.asciz " \n"
.align 4
.globl boot_msg2
boot_msg2:
.asciz "Booting Sparclinux V0.00 PRE-ALPHA on a (SUN4C)\n\n"
.align 4
pstring1:
.asciz "Prom Magic Cookie: 0x%x "
.align 4
pstring2:
.asciz "Interface Version: v%d\n"
.align 4
pstring3:
.asciz "Prom Revision: V%d\n\n"
.align 4
pstring4:
.ascii "Total Physical Memory: %d bytes\nVM mapped by Prom: %d bytes\n"
.asciz "Available Physical Memory: %d bytes\n"
.align 4
newline:
.asciz "\n"
.align 4
.text
.globl _msgbuf
msgbufsize = NBPG ! 1 page for msg buffer
_msgbuf = KERNBASE + NBPG
IE_reg_addr = _msgbuf + msgbufsize ! this page not used; points to IEreg
/*
ignore the following variable settings, I used them when I had
no stinkin idea what the linker was doing with the symbols to
get them in the right place for load time
*/
whereis_bootmsg = boot_msg-KERNBASE
whereis_kernbase = KERNBASE
whereis_prom_vector_p = _prom_vector_p-KERNBASE
whereis_prom_eval = prom_eval-KERNBASE
whereis_prom_halt = prom_halt-KERNBASE
.globl start
.globl _trapbase
start:
_trapbase:
b dostart; nop; nop; nop ! we never get trap #0 it is special
! TRAP code should go here, TODO :>
_msgbufmapped:
.word 1
.data
.skip 32 ! alignment byte & negative indicies
uwtab: .skip 32 ! u_char uwtab[-31..31];
wmask: .skip 32 ! u_char wmask[0..31];
.text
dostart: mov %o0, %g7
st %o0, [_prom_vector_p] ! we will need it later
ld [%g7 + 0x4], %o2
cmp %o2, 2 ! a v2 prom?
be _no_v2_here
nop
set 0x4000, %g6
cmp %o0, %g6 ! an old sun4?
beq no_sun4_here
nop
ld [%g7 + 0x1c], %o4
ld [%o4], %o4
call %o4
mov 0, %o0
set _cputypvar, %o1
set _cputypval, %o2
ld [%g7 + 0x1c], %o4
ld [%o4 + 0x0c], %o4
call %o4
nop
set _cputypval, %o2
ldub [%o2 + 4], %o0
cmp %o0, 'c'
beq is_sun4c
nop
cmp %o0, 'm'
beq no_sun4m_here
nop
b no_sun4d_here
nop
is_sun4c: ! OK, this is a sun4c, yippie
mov %g7, %g6 ! load up them promvec offsets
st %g6, [prom_magic] ! magic mushroom :>
add %g7, 0x4, %g6
st %g6, [prom_rom_vers]
add %g7, 0x8, %g6
st %g6, [prom_pluginvers]
add %g7, 0xc, %g6
st %g6, [prom_revision]
add %g7, 0x10, %g6
st %g6, [prom_v0mem_desc]
add %g7, 0x1c, %g6
st %g6, [prom_nodefuncs]
add %g7, 0x20, %g6
st %g6, [prom_bootstr]
add %g7, 0x24, %g6
st %g6, [prom_v0devfuncs]
add %g7, 0x48, %g6
st %g6, [prom_stdin]
add %g7, 0x4c, %g6
st %g6, [prom_stdout]
add %g7, 0x54, %g6
st %g6, [prom_putchar]
add %g7, 0x50, %g6
st %g6, [prom_getchar]
add %g7, 0x5c, %g6
st %g6, [prom_nputchar]
add %g7, 0x58, %g6
st %g6, [prom_ngetchar]
add %g7, 0x60, %g6
st %g6, [prom_putstring]
add %g7, 0x64, %g6
st %g6, [prom_bootme]
add %g7, 0x68, %g6
st %g6, [prom_printf]
add %g7, 0x6c, %g6
st %g6, [prom_abort]
add %g7, 0x70, %g6
st %g6, [prom_ticks]
add %g7, 0x74, %g6
st %g6, [prom_halt]
add %g7, 0x78, %g6
st %g6, [prom_sync]
add %g7, 0x7c, %g6
st %g6, [prom_eval]
add %g7, 0x80, %g6
st %g6, [prom_v0bootarg]
add %g7, 0x84, %g6
st %g6, [prom_ethaddr_func]
add %g7, 0x88, %g6
st %g6, [prom_v2bootarg]
add %g7, 0x98, %g6
st %g6, [prom_v2devfunc]
add %g7, 0xc8, %g6
st %g6, [prom_xtra_array]
add %g7, 0x104, %g6
st %g6, [prom_setcontext]
set boot_msg-KERNBASE, %o0
ld [prom_printf-KERNBASE], %o2
ld [%o2], %o1
call %o1 ! print boot message #1
nop
set newline-KERNBASE, %o0
ld [prom_printf-KERNBASE], %o2
ld [%o2], %o1
call %o1
nop
b 0f
nop
0: nop ! duh
set pstring1-KERNBASE, %o0
ld [prom_printf-KERNBASE], %o3
ld [%o3], %o2
ld [prom_magic-KERNBASE], %o3
ld [%o3], %o1
call %o2
nop; nop; nop
set pstring2-KERNBASE, %o0
ld [prom_printf-KERNBASE], %o3
ld [%o3], %o2
ld [prom_rom_vers-KERNBASE], %o3
ld [%o3], %o1
call %o2
nop; nop; nop
set pstring4-KERNBASE, %o0
ld [prom_printf-KERNBASE], %o5
ld [%o5], %o4
ld [_prom_vector_p], %l1
ld [%l1+16], %l2
ld [%l2], %l3
ld [%l3 + 8], %o1
/*
ld [%l1], %l2
ld [%l2 + 0x8], %o1 ! physical memory accumulator
*/
ld [_prom_vector_p], %l1
ld [%l1 + 16], %l2
ld [%l2], %l3
ld [%l3], %l4
/* ld [%l3], %l4 */
memloop:
cmp %l4, 0
be mv_to_vmprom ! is there more?
nop
ld [%l4 + 0x8], %l6 ! aparently so...
add %o1, %l6, %o1
b memloop
ld [%l4], %l4
mv_to_vmprom:
ld [_prom_vector_p], %l0
ld [%l0 + 20], %l1
ld [%l1], %l2
ld [%l2 + 8], %o2 ! memory accumulator
ld [_prom_vector_p], %l0
ld [%l0 + 20], %l1
ld [%l1], %l2
ld [%l2], %l4
memloop2:
cmp %l4, 0
be mv_to_vmprom2 ! is there more?
nop
ld [%l4 + 0x8], %l6 ! aparently so...
add %o2, %l6, %o2
b memloop2
ld [%l4], %l4
mv_to_vmprom2:
ld [_prom_vector_p], %l0
ld [%l0 + 24], %l1
ld [%l1], %l2
ld [%l2 + 8], %o3 ! memory accumulator
ld [_prom_vector_p], %l0
ld [%l0 + 24], %l1
ld [%l1], %l2
ld [%l2], %l4
memloop3:
cmp %l4, 0
be mv_to_vmprom3 ! is there more?
nop
ld [%l4 + 0x8], %l6 ! aparently so...
add %o3, %l6, %o3
b memloop3
ld [%l4], %l4
mv_to_vmprom3:
call %o4
nop; nop; nop
set newline-KERNBASE, %o0
ld [prom_printf-KERNBASE], %o2
ld [%o2], %o1
call %o1
nop
b halt_me
nop
.globl _no_v2_here
_no_v2_here:
ld [%g7 + 0x68], %o1
set v2_prom_notyet-KERNBASE, %o0
call %o1
nop
b halt_me
nop
no_sun4_here:
ld [%g7 + 0x68], %o1
set sun4_notsup, %o0
call %o1
nop
b halt_me
nop
no_sun4m_here:
ld [%g7 + 0x68], %o1
set sun4m_notsup, %o0
call %o1
nop
b halt_me
nop
no_sun4d_here:
ld [%g7 + 0x68], %o1
set sun4d_notsup, %o0
call %o1
nop
b halt_me
nop
halt_me:
ld [%g7 + 0x74], %o0
call %o0 ! get us out of here...
nop ! aparently solaris is better
_strlen:
mov %o0, %l1
mov %g0, %l3
ldub [%l1], %l2
sll %l2, 24, %l2
sra %l2, 24, %l2
len_loop:
cmp %l2, 0
be len_loop_end
nop
add %l3, 0x1, %l3
add %l1, 0x1, %l1
ldub [%l1], %l2
sll %l2, 24, %l2
sra %l2, 24, %l2
b len_loop
nop
len_loop_end:
mov %l3, %o0
ret
nop
#define KERNSIZE 134217728
#define KERNBASE -134217728
#define NBPG 4096
#define UPAGES 2
#define PROM_BASE -1568768
#define WHO_COMPILED_ME "someone@somewhere.domain"
...@@ -219,6 +219,10 @@ static void make_request(int major,int rw, struct buffer_head * bh) ...@@ -219,6 +219,10 @@ static void make_request(int major,int rw, struct buffer_head * bh)
bh->b_req = 0; bh->b_req = 0;
return; return;
} }
/* Uhhuh.. Nasty dead-lock possible here.. */
if (bh->b_lock)
return;
/* Maybe the above fixes it, and maybe it doesn't boot. Life is interesting */
lock_buffer(bh); lock_buffer(bh);
if ((rw == WRITE && !bh->b_dirt) || (rw == READ && bh->b_uptodate)) { if ((rw == WRITE && !bh->b_dirt) || (rw == READ && bh->b_uptodate)) {
unlock_buffer(bh); unlock_buffer(bh);
......
...@@ -180,8 +180,7 @@ endif ...@@ -180,8 +180,7 @@ endif
net.a: $(NETDRV_OBJS) net.a: $(NETDRV_OBJS)
rm -f net.a rm -f net.a
ar rc net.a $(NETDRV_OBJS) ar rcs net.a $(NETDRV_OBJS)
ranlib net.a
clean: clean:
rm -f core *.o *.a *.s rm -f core *.o *.a *.s
......
...@@ -276,16 +276,17 @@ static char scan_scsis_buf[512]; ...@@ -276,16 +276,17 @@ static char scan_scsis_buf[512];
*/ */
struct pci_chip { struct pci_chip {
short pci_device_id; unsigned short pci_device_id;
int chip; int chip;
int max_revision; int max_revision;
int min_revision; int min_revision;
}; };
static struct pci_chip pci_chip_ids[3] = { static struct pci_chip pci_chip_ids[] = {
{PCI_DEVICE_ID_NCR_53C810, 810, 1, 1}, {PCI_DEVICE_ID_NCR_53C810, 810, 1, 1},
{PCI_DEVICE_ID_NCR_53C815, 815, 2, 3},
{PCI_DEVICE_ID_NCR_53C820, 820, -1, -1}, {PCI_DEVICE_ID_NCR_53C820, 820, -1, -1},
{PCI_DEVICE_ID_NCR_53C825, 825, -1, -1}, {PCI_DEVICE_ID_NCR_53C825, 825, -1, -1}
}; };
#define NPCI_CHIP_IDS (sizeof (pci_chip_ids) / sizeof(pci_chip_ids[0])) #define NPCI_CHIP_IDS (sizeof (pci_chip_ids) / sizeof(pci_chip_ids[0]))
...@@ -413,6 +414,7 @@ static int NCR53c7x0_init (struct Scsi_Host *host) { ...@@ -413,6 +414,7 @@ static int NCR53c7x0_init (struct Scsi_Host *host) {
switch (hostdata->chip) { switch (hostdata->chip) {
case 810: case 810:
case 815: case 815:
case 820:
case 825: case 825:
hostdata->dstat_sir_intr = NCR53c8x0_dstat_sir_intr; hostdata->dstat_sir_intr = NCR53c8x0_dstat_sir_intr;
hostdata->init_save_regs = NULL; hostdata->init_save_regs = NULL;
......
...@@ -6,9 +6,6 @@ ...@@ -6,9 +6,6 @@
# unless its something special (ie not a .c file). # unless its something special (ie not a .c file).
# #
#AHA152X = -DDEBUG -DAUTOCONF -DIRQ=11 -DSCSI_ID=7 -DRECONNECT=0 \
# -DPORTBASE=0x340 -DSKIP_BIOSTEST -DDONT_SNARF
AHA152X = -DDEBUG_AHA152X -DAUTOCONF AHA152X = -DDEBUG_AHA152X -DAUTOCONF
ifeq (${CFLAGS},) ifeq (${CFLAGS},)
......
...@@ -197,6 +197,12 @@ void aha1740_intr_handle(int foo) ...@@ -197,6 +197,12 @@ void aha1740_intr_handle(int foo)
continue; continue;
} }
SCtmp = ecbptr->SCpnt; SCtmp = ecbptr->SCpnt;
if (!SCtmp)
{
printk("Aha1740 null SCtmp in interrupt (%x,%x,%x,%d)\n",
inb(G2STAT),adapstat,inb(G2INTST),number_serviced++);
continue;
}
if (SCtmp->host_scribble) if (SCtmp->host_scribble)
scsi_free(SCtmp->host_scribble, 512); scsi_free(SCtmp->host_scribble, 512);
/* Fetch the sense data, and tuck it away, in the required slot. The /* Fetch the sense data, and tuck it away, in the required slot. The
......
...@@ -1215,8 +1215,8 @@ int buslogic_detect(Scsi_Host_Template *tpnt) ...@@ -1215,8 +1215,8 @@ int buslogic_detect(Scsi_Host_Template *tpnt)
if (bus_type == 'V' /* 445 */ if (bus_type == 'V' /* 445 */
&& firmware_rev[0] <= '3' /* S */ && firmware_rev[0] <= '3' /* S */
&& bios != NULL) { /* BIOS enabled */ && bios != NULL) { /* BIOS enabled */
#if 0 #if 1
/* ??? Once LNZ's forbidden_addr stuff makes it into the higher /* Now that LNZ's forbidden_addr stuff makes it into the higher
level scsi code, we can use this instead. */ level scsi code, we can use this instead. */
/* Avoid addresses which "mirror" the BIOS for DMA. */ /* Avoid addresses which "mirror" the BIOS for DMA. */
shpnt->forbidden_addr = bios; shpnt->forbidden_addr = bios;
......
...@@ -236,6 +236,8 @@ struct Scsi_Host * scsi_register(Scsi_Host_Template * tpnt, int j){ ...@@ -236,6 +236,8 @@ struct Scsi_Host * scsi_register(Scsi_Host_Template * tpnt, int j){
retval->host_wait = NULL; retval->host_wait = NULL;
retval->last_reset = 0; retval->last_reset = 0;
retval->irq = 0; retval->irq = 0;
retval->forbidden_addr = 0;
retval->forbidden_size = 0;
retval->hostt = tpnt; retval->hostt = tpnt;
retval->next = NULL; retval->next = NULL;
#ifdef DEBUG #ifdef DEBUG
...@@ -328,3 +330,21 @@ unsigned int scsi_init() ...@@ -328,3 +330,21 @@ unsigned int scsi_init()
max_scsi_hosts = count; max_scsi_hosts = count;
return 0; return 0;
} }
void scsi_mem_init(unsigned long memory_end)
{
struct Scsi_Host *Host;
long High8, Low24;
for (Host = scsi_hostlist; Host != NULL; Host = Host->next)
if (Host->forbidden_addr > 0 && Host->forbidden_size > 0)
for (High8 = 1<<24; High8 < memory_end; High8 += 1<<24)
for (Low24 = Host->forbidden_addr;
Low24 < Host->forbidden_addr + Host->forbidden_size;
Low24 += PAGE_SIZE)
{
unsigned long ForbiddenAddress = High8 + Low24;
if (ForbiddenAddress >= memory_end) break;
mem_map[MAP_NR(ForbiddenAddress)] = MAP_PAGE_RESERVED;
}
}
...@@ -252,6 +252,15 @@ struct Scsi_Host ...@@ -252,6 +252,15 @@ struct Scsi_Host
unsigned char n_io_port; unsigned char n_io_port;
unsigned char irq; unsigned char irq;
unsigned char dma_channel; unsigned char dma_channel;
/*
Set these if there are conflicts between memory
in the < 1mb region and regions at 16mb multiples.
The address must be on a page boundary.
*/
unsigned long forbidden_addr;
unsigned long forbidden_size;
/* /*
The rest can be copied from the template, or specifically The rest can be copied from the template, or specifically
initialized, as required. initialized, as required.
......
...@@ -41,7 +41,7 @@ const unsigned char scsi_command_size[8] = { 6, 10, 10, 12, 12, 12, 10, 10 }; ...@@ -41,7 +41,7 @@ const unsigned char scsi_command_size[8] = { 6, 10, 10, 12, 12, 12, 10, 10 };
static void scsi_done (Scsi_Cmnd *SCpnt); static void scsi_done (Scsi_Cmnd *SCpnt);
static int update_timeout (Scsi_Cmnd *, int); static int update_timeout (Scsi_Cmnd *, int);
static void print_inquiry(unsigned char *data); static void print_inquiry(unsigned char *data);
static void scsi_times_out (Scsi_Cmnd * SCpnt); static void scsi_times_out (Scsi_Cmnd * SCpnt, int pid);
static int time_start; static int time_start;
static int time_elapsed; static int time_elapsed;
...@@ -525,7 +525,7 @@ static void scan_scsis (struct Scsi_Host * shpnt) ...@@ -525,7 +525,7 @@ static void scan_scsis (struct Scsi_Host * shpnt)
command, that failing perform a kernel panic. command, that failing perform a kernel panic.
*/ */
static void scsi_times_out (Scsi_Cmnd * SCpnt) static void scsi_times_out (Scsi_Cmnd * SCpnt, int pid)
{ {
switch (SCpnt->internal_timeout & (IN_ABORT | IN_RESET)) switch (SCpnt->internal_timeout & (IN_ABORT | IN_RESET))
...@@ -537,7 +537,7 @@ static void scsi_times_out (Scsi_Cmnd * SCpnt) ...@@ -537,7 +537,7 @@ static void scsi_times_out (Scsi_Cmnd * SCpnt)
#endif #endif
} }
if (!scsi_abort (SCpnt, DID_TIME_OUT)) if (!scsi_abort (SCpnt, DID_TIME_OUT, pid))
return; return;
case IN_ABORT: case IN_ABORT:
printk("SCSI host %d abort() timed out - resetting\n", printk("SCSI host %d abort() timed out - resetting\n",
...@@ -837,8 +837,6 @@ static void scsi_request_sense (Scsi_Cmnd * SCpnt) ...@@ -837,8 +837,6 @@ static void scsi_request_sense (Scsi_Cmnd * SCpnt)
SCpnt->use_sg = 0; SCpnt->use_sg = 0;
SCpnt->cmd_len = COMMAND_SIZE(SCpnt->cmnd[0]); SCpnt->cmd_len = COMMAND_SIZE(SCpnt->cmnd[0]);
internal_cmnd (SCpnt); internal_cmnd (SCpnt);
SCpnt->use_sg = SCpnt->old_use_sg;
SCpnt->cmd_len = SCpnt->old_cmd_len;
} }
...@@ -1085,6 +1083,13 @@ static void scsi_done (Scsi_Cmnd * SCpnt) ...@@ -1085,6 +1083,13 @@ static void scsi_done (Scsi_Cmnd * SCpnt)
#ifdef DEBUG #ifdef DEBUG
printk("In scsi_done(host = %d, result = %06x)\n", host->host_no, result); printk("In scsi_done(host = %d, result = %06x)\n", host->host_no, result);
#endif #endif
if(SCpnt->flags & WAS_SENSE)
{
SCpnt->use_sg = SCpnt->old_use_sg;
SCpnt->cmd_len = SCpnt->old_cmd_len;
}
switch (host_byte(result)) switch (host_byte(result))
{ {
case DID_OK: case DID_OK:
...@@ -1400,7 +1405,7 @@ static void scsi_done (Scsi_Cmnd * SCpnt) ...@@ -1400,7 +1405,7 @@ static void scsi_done (Scsi_Cmnd * SCpnt)
*/ */
int scsi_abort (Scsi_Cmnd * SCpnt, int why) int scsi_abort (Scsi_Cmnd * SCpnt, int why, int pid)
{ {
int oldto; int oldto;
struct Scsi_Host * host = SCpnt->host; struct Scsi_Host * host = SCpnt->host;
...@@ -1408,6 +1413,16 @@ int scsi_abort (Scsi_Cmnd * SCpnt, int why) ...@@ -1408,6 +1413,16 @@ int scsi_abort (Scsi_Cmnd * SCpnt, int why)
while(1) while(1)
{ {
cli(); cli();
/*
* Protect against races here. If the command is done, or we are
* on a different command forget it.
*/
if (SCpnt->request.dev == -1 || pid != SCpnt->pid) {
sti();
return 0;
}
if (SCpnt->internal_timeout & IN_ABORT) if (SCpnt->internal_timeout & IN_ABORT)
{ {
sti(); sti();
...@@ -1436,6 +1451,8 @@ int scsi_abort (Scsi_Cmnd * SCpnt, int why) ...@@ -1436,6 +1451,8 @@ int scsi_abort (Scsi_Cmnd * SCpnt, int why)
SCpnt->pid, SCpnt->host->host_no, (int) SCpnt->target, (int) SCpnt->pid, SCpnt->host->host_no, (int) SCpnt->target, (int)
SCpnt->lun); SCpnt->lun);
print_command (SCpnt->cmnd); print_command (SCpnt->cmnd);
if (SCpnt->request.dev == -1 || pid != SCpnt->pid)
return 0;
SCpnt->abort_reason = why; SCpnt->abort_reason = why;
switch(host->hostt->abort(SCpnt)) { switch(host->hostt->abort(SCpnt)) {
/* We do not know how to abort. Try waiting another /* We do not know how to abort. Try waiting another
...@@ -1473,6 +1490,7 @@ int scsi_abort (Scsi_Cmnd * SCpnt, int why) ...@@ -1473,6 +1490,7 @@ int scsi_abort (Scsi_Cmnd * SCpnt, int why)
need to adjust timeout */ need to adjust timeout */
case SCSI_ABORT_NOT_RUNNING: case SCSI_ABORT_NOT_RUNNING:
SCpnt->internal_timeout &= ~IN_ABORT; SCpnt->internal_timeout &= ~IN_ABORT;
update_timeout(SCpnt, 0);
return 0; return 0;
case SCSI_ABORT_ERROR: case SCSI_ABORT_ERROR:
default: default:
...@@ -1513,7 +1531,7 @@ int scsi_reset (Scsi_Cmnd * SCpnt) ...@@ -1513,7 +1531,7 @@ int scsi_reset (Scsi_Cmnd * SCpnt)
#if 0 #if 0
if (!(SCpnt1->flags & IS_RESETTING) && if (!(SCpnt1->flags & IS_RESETTING) &&
!(SCpnt1->internal_timeout & IN_ABORT)) !(SCpnt1->internal_timeout & IN_ABORT))
scsi_abort(SCpnt1, DID_RESET); scsi_abort(SCpnt1, DID_RESET, SCpnt->pid);
#endif #endif
SCpnt1->flags |= IS_RESETTING; SCpnt1->flags |= IS_RESETTING;
} }
...@@ -1576,7 +1594,7 @@ static void scsi_main_timeout(void) ...@@ -1576,7 +1594,7 @@ static void scsi_main_timeout(void)
We must not enter update_timeout with a timeout condition still pending. We must not enter update_timeout with a timeout condition still pending.
*/ */
int timed_out; int timed_out, pid;
struct Scsi_Host * host; struct Scsi_Host * host;
Scsi_Cmnd * SCpnt = NULL; Scsi_Cmnd * SCpnt = NULL;
...@@ -1594,9 +1612,10 @@ static void scsi_main_timeout(void) ...@@ -1594,9 +1612,10 @@ static void scsi_main_timeout(void)
for(SCpnt = host->host_queue; SCpnt; SCpnt = SCpnt->next) for(SCpnt = host->host_queue; SCpnt; SCpnt = SCpnt->next)
if (SCpnt->timeout == -1) if (SCpnt->timeout == -1)
{ {
sti();
SCpnt->timeout = 0; SCpnt->timeout = 0;
scsi_times_out(SCpnt); pid = SCpnt->pid;
sti();
scsi_times_out(SCpnt, SCpnt);
++timed_out; ++timed_out;
cli(); cli();
} }
......
...@@ -510,7 +510,7 @@ typedef struct scsi_cmnd { ...@@ -510,7 +510,7 @@ typedef struct scsi_cmnd {
DID_ABORT is returned in the hostbyte. DID_ABORT is returned in the hostbyte.
*/ */
extern int scsi_abort (Scsi_Cmnd *, int code); extern int scsi_abort (Scsi_Cmnd *, int code, int pid);
extern void scsi_do_cmd (Scsi_Cmnd *, const void *cmnd , extern void scsi_do_cmd (Scsi_Cmnd *, const void *cmnd ,
void *buffer, unsigned bufflen, void (*done)(struct scsi_cmnd *), void *buffer, unsigned bufflen, void (*done)(struct scsi_cmnd *),
...@@ -564,6 +564,7 @@ static Scsi_Cmnd * end_scsi_request(Scsi_Cmnd * SCpnt, int uptodate, int sectors ...@@ -564,6 +564,7 @@ static Scsi_Cmnd * end_scsi_request(Scsi_Cmnd * SCpnt, int uptodate, int sectors
up(req->sem); up(req->sem);
} }
req->dev = -1; req->dev = -1;
wake_up(&wait_for_request);
wake_up(&SCpnt->device->device_wait); wake_up(&SCpnt->device->device_wait);
return NULL; return NULL;
} }
......
...@@ -108,7 +108,9 @@ static int sg_open(struct inode * inode, struct file * filp) ...@@ -108,7 +108,9 @@ static int sg_open(struct inode * inode, struct file * filp)
} }
if (!scsi_generics[dev].users && scsi_generics[dev].pending && scsi_generics[dev].complete) if (!scsi_generics[dev].users && scsi_generics[dev].pending && scsi_generics[dev].complete)
{ {
if (scsi_generics[dev].buff != NULL)
scsi_free(scsi_generics[dev].buff,scsi_generics[dev].buff_len); scsi_free(scsi_generics[dev].buff,scsi_generics[dev].buff_len);
scsi_generics[dev].buff=NULL;
scsi_generics[dev].pending=0; scsi_generics[dev].pending=0;
} }
if (!scsi_generics[dev].users) if (!scsi_generics[dev].users)
...@@ -188,6 +190,7 @@ static int sg_read(struct inode *inode,struct file *filp,char *buf,int count) ...@@ -188,6 +190,7 @@ static int sg_read(struct inode *inode,struct file *filp,char *buf,int count)
else else
count=0; count=0;
sg_free(device->buff,device->buff_len); sg_free(device->buff,device->buff_len);
device->buff = NULL;
device->pending=0; device->pending=0;
wake_up(&device->write_wait); wake_up(&device->write_wait);
return count; return count;
...@@ -266,6 +269,7 @@ static int sg_write(struct inode *inode,struct file *filp,char *buf,int count) ...@@ -266,6 +269,7 @@ static int sg_write(struct inode *inode,struct file *filp,char *buf,int count)
device->pending=0; device->pending=0;
wake_up(&device->write_wait); wake_up(&device->write_wait);
sg_free(device->buff,device->buff_len); sg_free(device->buff,device->buff_len);
device->buff = NULL;
return -EWOULDBLOCK; return -EWOULDBLOCK;
} }
#ifdef DEBUG #ifdef DEBUG
...@@ -370,6 +374,7 @@ static void sg_attach(Scsi_Device * SDp) ...@@ -370,6 +374,7 @@ static void sg_attach(Scsi_Device * SDp)
scsi_generics[i].generic_wait=NULL; scsi_generics[i].generic_wait=NULL;
scsi_generics[i].read_wait=NULL; scsi_generics[i].read_wait=NULL;
scsi_generics[i].write_wait=NULL; scsi_generics[i].write_wait=NULL;
scsi_generics[i].buff=NULL;
scsi_generics[i].exclude=0; scsi_generics[i].exclude=0;
scsi_generics[i].pending=0; scsi_generics[i].pending=0;
scsi_generics[i].timeout=SG_DEFAULT_TIMEOUT; scsi_generics[i].timeout=SG_DEFAULT_TIMEOUT;
......
...@@ -36,6 +36,8 @@ FS_SUBDIRS := $(FS_SUBDIRS) nfs ...@@ -36,6 +36,8 @@ FS_SUBDIRS := $(FS_SUBDIRS) nfs
endif endif
ifdef CONFIG_XIA_FS ifdef CONFIG_XIA_FS
FS_SUBDIRS := $(FS_SUBDIRS) xiafs FS_SUBDIRS := $(FS_SUBDIRS) xiafs
else
MODULE_FS_SUBDIRS := $(MODULE_FS_SUBDIRS) xiafs
endif endif
ifdef CONFIG_UMSDOS_FS ifdef CONFIG_UMSDOS_FS
FS_SUBDIRS := $(FS_SUBDIRS) umsdos FS_SUBDIRS := $(FS_SUBDIRS) umsdos
...@@ -44,6 +46,8 @@ MODULE_FS_SUBDIRS := $(MODULE_FS_SUBDIRS) umsdos ...@@ -44,6 +46,8 @@ MODULE_FS_SUBDIRS := $(MODULE_FS_SUBDIRS) umsdos
endif endif
ifdef CONFIG_SYSV_FS ifdef CONFIG_SYSV_FS
FS_SUBDIRS := $(FS_SUBDIRS) sysv FS_SUBDIRS := $(FS_SUBDIRS) sysv
else
MODULE_FS_SUBDIRS := $(MODULE_FS_SUBDIRS) sysv
endif endif
ifdef CONFIG_HPFS_FS ifdef CONFIG_HPFS_FS
FS_SUBDIRS := $(FS_SUBDIRS) hpfs FS_SUBDIRS := $(FS_SUBDIRS) hpfs
...@@ -95,7 +99,8 @@ modules_fs: ...@@ -95,7 +99,8 @@ modules_fs:
set -e; for i in $(MODULE_FS_SUBDIRS); do \ set -e; for i in $(MODULE_FS_SUBDIRS); do \
test ! -d $$i || \ test ! -d $$i || \
{ $(MAKE) -C $$i; }; done { $(MAKE) -C $$i; }; done
(cd ../modules; \
for i in $(MODULE_FS_SUBDIRS); do ln -sf ../fs/$$i/$$i.o .; done)
else else
......
...@@ -65,10 +65,6 @@ struct file_operations * get_chrfops(unsigned int major) ...@@ -65,10 +65,6 @@ struct file_operations * get_chrfops(unsigned int major)
int register_chrdev(unsigned int major, const char * name, struct file_operations *fops) int register_chrdev(unsigned int major, const char * name, struct file_operations *fops)
{ {
if (major == 0) { if (major == 0) {
for (major = MAX_CHRDEV-1; major > 0; major--) {
if (chrdevs[major].fops == fops)
return major;
}
for (major = MAX_CHRDEV-1; major > 0; major--) { for (major = MAX_CHRDEV-1; major > 0; major--) {
if (chrdevs[major].fops == NULL) { if (chrdevs[major].fops == NULL) {
chrdevs[major].name = name; chrdevs[major].name = name;
...@@ -90,10 +86,6 @@ int register_chrdev(unsigned int major, const char * name, struct file_operation ...@@ -90,10 +86,6 @@ int register_chrdev(unsigned int major, const char * name, struct file_operation
int register_blkdev(unsigned int major, const char * name, struct file_operations *fops) int register_blkdev(unsigned int major, const char * name, struct file_operations *fops)
{ {
if (major == 0) { if (major == 0) {
for (major = MAX_BLKDEV-1; major > 0; major--) {
if (blkdevs[major].fops == fops)
return major;
}
for (major = MAX_BLKDEV-1; major > 0; major--) { for (major = MAX_BLKDEV-1; major > 0; major--) {
if (blkdevs[major].fops == NULL) { if (blkdevs[major].fops == NULL) {
blkdevs[major].name = name; blkdevs[major].name = name;
......
...@@ -13,6 +13,9 @@ ...@@ -13,6 +13,9 @@
* bad '!' which forced address recalculation for * bad '!' which forced address recalculation for
* EVERY character on the current page. * EVERY character on the current page.
* <middelin@polyware.iaf.nl> * <middelin@polyware.iaf.nl>
*
* Danny ter Haar : Some minor additions for cpuinfo
* <danny@ow.nl>
*/ */
#include <linux/types.h> #include <linux/types.h>
...@@ -176,6 +179,22 @@ static int get_version(char * buffer) ...@@ -176,6 +179,22 @@ static int get_version(char * buffer)
return strlen(buffer); return strlen(buffer);
} }
static int get_cpuinfo(char * buffer)
{
return sprintf(buffer,"cpu : %d86\n"
"vid : %s\n"
"fdiv_bug : %s\n"
"math : %s\n"
"hlt : %s\n"
"wp : %s\n",
x86,
x86_vendor_id,
fdiv_bug ? "yes" : "no",
hard_math ? "yes" : "no",
hlt_works_ok ? "yes" : "no",
wp_works_ok ? "yes" : "no");
}
static struct task_struct ** get_task(pid_t pid) static struct task_struct ** get_task(pid_t pid)
{ {
struct task_struct ** p; struct task_struct ** p;
...@@ -464,6 +483,7 @@ extern int get_filesystem_list(char *); ...@@ -464,6 +483,7 @@ extern int get_filesystem_list(char *);
extern int get_ksyms_list(char *); extern int get_ksyms_list(char *);
extern int get_irq_list(char *); extern int get_irq_list(char *);
extern int get_dma_list(char *); extern int get_dma_list(char *);
extern int get_cpuinfo(char *);
static int get_root_array(char * page, int type) static int get_root_array(char * page, int type)
{ {
...@@ -477,6 +497,9 @@ static int get_root_array(char * page, int type) ...@@ -477,6 +497,9 @@ static int get_root_array(char * page, int type)
case PROC_MEMINFO: case PROC_MEMINFO:
return get_meminfo(page); return get_meminfo(page);
case PROC_CPUINFO:
return get_cpuinfo(page);
case PROC_VERSION: case PROC_VERSION:
return get_version(page); return get_version(page);
...@@ -505,6 +528,7 @@ static int get_root_array(char * page, int type) ...@@ -505,6 +528,7 @@ static int get_root_array(char * page, int type)
case PROC_DMA: case PROC_DMA:
return get_dma_list(page); return get_dma_list(page);
} }
return -EBADF; return -EBADF;
} }
......
...@@ -59,6 +59,7 @@ static struct proc_dir_entry root_dir[] = { ...@@ -59,6 +59,7 @@ static struct proc_dir_entry root_dir[] = {
{ PROC_MEMINFO, 7, "meminfo" }, { PROC_MEMINFO, 7, "meminfo" },
{ PROC_KMSG, 4, "kmsg" }, { PROC_KMSG, 4, "kmsg" },
{ PROC_VERSION, 7, "version" }, { PROC_VERSION, 7, "version" },
{ PROC_CPUINFO, 7, "cpuinfo" },
{ PROC_SELF, 4, "self" }, /* will change inode # */ { PROC_SELF, 4, "self" }, /* will change inode # */
{ PROC_NET, 3, "net" }, { PROC_NET, 3, "net" },
#ifdef CONFIG_DEBUG_MALLOC #ifdef CONFIG_DEBUG_MALLOC
......
...@@ -7,6 +7,10 @@ ...@@ -7,6 +7,10 @@
# #
# Note 2! The CFLAGS definitions are now in the main makefile... # Note 2! The CFLAGS definitions are now in the main makefile...
ifndef CONFIG_SYSV_FS
CFLAGS := $(CFLAGS) -DMODULE
endif
.c.s: .c.s:
$(CC) $(CFLAGS) -S $< $(CC) $(CFLAGS) -S $<
.c.o: .c.o:
......
...@@ -30,6 +30,14 @@ ...@@ -30,6 +30,14 @@
#include <asm/segment.h> #include <asm/segment.h>
#ifdef MODULE
#include <linux/module.h>
#include "../../tools/version.h"
#else
#define MOD_INC_USE_COUNT
#define MOD_DEC_USE_COUNT
#endif
void sysv_put_inode(struct inode *inode) void sysv_put_inode(struct inode *inode)
{ {
if (inode->i_nlink) if (inode->i_nlink)
...@@ -348,6 +356,7 @@ struct super_block *sysv_read_super(struct super_block *sb,void *data, ...@@ -348,6 +356,7 @@ struct super_block *sysv_read_super(struct super_block *sb,void *data,
panic("Coherent FS: bad super-block size"); panic("Coherent FS: bad super-block size");
if (64 != sizeof (struct sysv_inode)) if (64 != sizeof (struct sysv_inode))
panic("sysv fs: bad i-node size"); panic("sysv fs: bad i-node size");
MOD_INC_USE_COUNT;
lock_super(sb); lock_super(sb);
set_blocksize(dev,BLOCK_SIZE); set_blocksize(dev,BLOCK_SIZE);
...@@ -390,6 +399,8 @@ struct super_block *sysv_read_super(struct super_block *sb,void *data, ...@@ -390,6 +399,8 @@ struct super_block *sysv_read_super(struct super_block *sb,void *data,
unlock_super(sb); unlock_super(sb);
if (!silent) if (!silent)
printk("VFS: unable to read Xenix/SystemV/Coherent superblock on device %d/%d\n",MAJOR(dev),MINOR(dev)); printk("VFS: unable to read Xenix/SystemV/Coherent superblock on device %d/%d\n",MAJOR(dev),MINOR(dev));
failed:
MOD_DEC_USE_COUNT;
return NULL; return NULL;
ok: ok:
...@@ -413,7 +424,7 @@ struct super_block *sysv_read_super(struct super_block *sb,void *data, ...@@ -413,7 +424,7 @@ struct super_block *sysv_read_super(struct super_block *sb,void *data,
sb->s_dev = 0; sb->s_dev = 0;
unlock_super(sb); unlock_super(sb);
printk("SysV FS: cannot read superblock in 1024 byte mode\n"); printk("SysV FS: cannot read superblock in 1024 byte mode\n");
return NULL; goto failed;
} }
} else { } else {
/* Switch to another block size. Unfortunately, we have to /* Switch to another block size. Unfortunately, we have to
...@@ -459,7 +470,7 @@ struct super_block *sysv_read_super(struct super_block *sb,void *data, ...@@ -459,7 +470,7 @@ struct super_block *sysv_read_super(struct super_block *sb,void *data,
sb->s_dev = 0; sb->s_dev = 0;
unlock_super(sb); unlock_super(sb);
printk("SysV FS: cannot read superblock in 512 byte mode\n"); printk("SysV FS: cannot read superblock in 512 byte mode\n");
return NULL; goto failed;
} }
} }
sb->sv_ninodes = (sb->sv_firstdatazone - sb->sv_firstinodezone) << sb->sv_inodes_per_block_bits; sb->sv_ninodes = (sb->sv_firstdatazone - sb->sv_firstinodezone) << sb->sv_inodes_per_block_bits;
...@@ -475,8 +486,8 @@ struct super_block *sysv_read_super(struct super_block *sb,void *data, ...@@ -475,8 +486,8 @@ struct super_block *sysv_read_super(struct super_block *sb,void *data,
sb->s_mounted = iget(sb,SYSV_ROOT_INO); sb->s_mounted = iget(sb,SYSV_ROOT_INO);
unlock_super(sb); unlock_super(sb);
if (!sb->s_mounted) { if (!sb->s_mounted) {
sysv_put_super(sb);
printk("SysV FS: get root inode failed\n"); printk("SysV FS: get root inode failed\n");
sysv_put_super(sb);
return NULL; return NULL;
} }
sb->s_dirt = 1; sb->s_dirt = 1;
...@@ -513,6 +524,7 @@ void sysv_put_super(struct super_block *sb) ...@@ -513,6 +524,7 @@ void sysv_put_super(struct super_block *sb)
set_blocksize(sb->s_dev,BLOCK_SIZE); set_blocksize(sb->s_dev,BLOCK_SIZE);
sb->s_dev = 0; sb->s_dev = 0;
unlock_super(sb); unlock_super(sb);
MOD_DEC_USE_COUNT;
} }
void sysv_statfs(struct super_block *sb, struct statfs *buf) void sysv_statfs(struct super_block *sb, struct statfs *buf)
...@@ -949,3 +961,39 @@ int sysv_sync_inode(struct inode * inode) ...@@ -949,3 +961,39 @@ int sysv_sync_inode(struct inode * inode)
return err; return err;
} }
#ifdef MODULE
/* Every kernel module contains stuff like this. */
char kernel_version[] = UTS_RELEASE;
static struct file_system_type sysv_fs_type[3] = {
{sysv_read_super, "xenix", 1, NULL},
{sysv_read_super, "sysv", 1, NULL},
{sysv_read_super, "coherent", 1, NULL}
};
int init_module(void)
{
int i;
for (i = 0; i < 3; i++)
register_filesystem(&sysv_fs_type[i]);
return 0;
}
void cleanup_module(void)
{
int i;
if (MOD_IN_USE) {
printk("SysV FS cannot be removed, currently in use\n");
return;
}
for (i = 0; i < 3; i++)
unregister_filesystem(&sysv_fs_type[i]);
}
#endif
...@@ -7,6 +7,10 @@ ...@@ -7,6 +7,10 @@
# #
# Note 2! The CFLAGS definitions are now in the main makefile... # Note 2! The CFLAGS definitions are now in the main makefile...
ifndef CONFIG_XIA_FS
CFLAGS := $(CFLAGS) -DMODULE
endif
.c.s: .c.s:
$(CC) $(CFLAGS) -S $< $(CC) $(CFLAGS) -S $<
.c.o: .c.o:
......
...@@ -19,6 +19,14 @@ ...@@ -19,6 +19,14 @@
#include <asm/system.h> #include <asm/system.h>
#include <asm/segment.h> #include <asm/segment.h>
#ifdef MODULE
#include <linux/module.h>
#include "../../tools/version.h"
#else
#define MOD_INC_USE_COUNT
#define MOD_DEC_USE_COUNT
#endif
#include "xiafs_mac.h" #include "xiafs_mac.h"
static u_long random_nr; static u_long random_nr;
...@@ -43,6 +51,7 @@ void xiafs_put_super(struct super_block *sb) ...@@ -43,6 +51,7 @@ void xiafs_put_super(struct super_block *sb)
for(i = 0 ; i < _XIAFS_ZMAP_SLOTS ; i++) for(i = 0 ; i < _XIAFS_ZMAP_SLOTS ; i++)
brelse(sb->u.xiafs_sb.s_zmap_buf[i]); brelse(sb->u.xiafs_sb.s_zmap_buf[i]);
unlock_super(sb); unlock_super(sb);
MOD_DEC_USE_COUNT;
} }
static struct super_operations xiafs_sops = { static struct super_operations xiafs_sops = {
...@@ -63,6 +72,7 @@ struct super_block *xiafs_read_super(struct super_block *s, void *data, ...@@ -63,6 +72,7 @@ struct super_block *xiafs_read_super(struct super_block *s, void *data,
struct xiafs_super_block *sp; struct xiafs_super_block *sp;
int i, z, dev; int i, z, dev;
MOD_INC_USE_COUNT;
dev=s->s_dev; dev=s->s_dev;
lock_super(s); lock_super(s);
...@@ -72,6 +82,7 @@ struct super_block *xiafs_read_super(struct super_block *s, void *data, ...@@ -72,6 +82,7 @@ struct super_block *xiafs_read_super(struct super_block *s, void *data,
s->s_dev=0; s->s_dev=0;
unlock_super(s); unlock_super(s);
printk("XIA-FS: read super_block failed (%s %d)\n", WHERE_ERR); printk("XIA-FS: read super_block failed (%s %d)\n", WHERE_ERR);
MOD_DEC_USE_COUNT;
return NULL; return NULL;
} }
sp = (struct xiafs_super_block *) bh->b_data; sp = (struct xiafs_super_block *) bh->b_data;
...@@ -83,6 +94,7 @@ struct super_block *xiafs_read_super(struct super_block *s, void *data, ...@@ -83,6 +94,7 @@ struct super_block *xiafs_read_super(struct super_block *s, void *data,
if (!silent) if (!silent)
printk("VFS: Can't find a xiafs filesystem on dev 0x%04x.\n", printk("VFS: Can't find a xiafs filesystem on dev 0x%04x.\n",
dev); dev);
MOD_DEC_USE_COUNT;
return NULL; return NULL;
} }
s->s_blocksize = sp->s_zone_size; s->s_blocksize = sp->s_zone_size;
...@@ -93,7 +105,10 @@ struct super_block *xiafs_read_super(struct super_block *s, void *data, ...@@ -93,7 +105,10 @@ struct super_block *xiafs_read_super(struct super_block *s, void *data,
brelse(bh); brelse(bh);
set_blocksize(dev, s->s_blocksize); set_blocksize(dev, s->s_blocksize);
bh = bread (dev, 0, s->s_blocksize); bh = bread (dev, 0, s->s_blocksize);
if(!bh) return NULL; if(!bh) {
MOD_DEC_USE_COUNT;
return NULL;
}
sp = (struct xiafs_super_block *) (((char *)bh->b_data) + BLOCK_SIZE) ; sp = (struct xiafs_super_block *) (((char *)bh->b_data) + BLOCK_SIZE) ;
}; };
s->u.xiafs_sb.s_nzones = sp->s_nzones; s->u.xiafs_sb.s_nzones = sp->s_nzones;
...@@ -152,6 +167,7 @@ struct super_block *xiafs_read_super(struct super_block *s, void *data, ...@@ -152,6 +167,7 @@ struct super_block *xiafs_read_super(struct super_block *s, void *data,
s->s_dev=0; s->s_dev=0;
unlock_super(s); unlock_super(s);
printk("XIA-FS: read bitmaps failed (%s %d)\n", WHERE_ERR); printk("XIA-FS: read bitmaps failed (%s %d)\n", WHERE_ERR);
MOD_DEC_USE_COUNT;
return NULL; return NULL;
} }
...@@ -500,3 +516,30 @@ int xiafs_sync_inode (struct inode *inode) ...@@ -500,3 +516,30 @@ int xiafs_sync_inode (struct inode *inode)
brelse (bh); brelse (bh);
return err; return err;
} }
#ifdef MODULE
/* Every kernel module contains stuff like this. */
char kernel_version[] = UTS_RELEASE;
static struct file_system_type xiafs_fs_type = {
xiafs_read_super, "xiafs", 1, NULL
};
int init_module(void)
{
register_filesystem(&xiafs_fs_type);
return 0;
}
void cleanup_module(void)
{
if (MOD_IN_USE) {
printk("XIA-FS cannot be removed, currently in use\n");
return;
}
unregister_filesystem(&xiafs_fs_type);
}
#endif
...@@ -20,8 +20,10 @@ typedef unsigned int __u32; ...@@ -20,8 +20,10 @@ typedef unsigned int __u32;
*/ */
#if ((~0UL) == 0xffffffff) #if ((~0UL) == 0xffffffff)
#ifndef __STRICT_ANSI__
typedef signed long long __s64; typedef signed long long __s64;
typedef unsigned long long __u64; typedef unsigned long long __u64;
#endif
#else #else
......
...@@ -18,8 +18,6 @@ __asm__ __volatile__ ("movl %%esp,%%eax\n\t" \ ...@@ -18,8 +18,6 @@ __asm__ __volatile__ ("movl %%esp,%%eax\n\t" \
"mov %%ax,%%gs" \ "mov %%ax,%%gs" \
: /* no outputs */ :"i" (USER_DS), "i" (USER_CS):"ax") : /* no outputs */ :"i" (USER_DS), "i" (USER_CS):"ax")
#define sti() __asm__ __volatile__ ("sti": : :"memory")
#define cli() __asm__ __volatile__ ("cli": : :"memory")
#define nop() __asm__ __volatile__ ("nop") #define nop() __asm__ __volatile__ ("nop")
/* /*
...@@ -44,6 +42,9 @@ extern inline int tas(char * m) ...@@ -44,6 +42,9 @@ extern inline int tas(char * m)
return res; return res;
} }
#define sti() __asm__ __volatile__ ("sti": : :"memory")
#define cli() __asm__ __volatile__ ("cli": : :"memory")
#define save_flags(x) \ #define save_flags(x) \
__asm__ __volatile__("pushfl ; popl %0":"=r" (x): /* no input */ :"memory") __asm__ __volatile__("pushfl ; popl %0":"=r" (x): /* no input */ :"memory")
......
...@@ -15,8 +15,10 @@ typedef unsigned short __u16; ...@@ -15,8 +15,10 @@ typedef unsigned short __u16;
typedef signed long __s32; typedef signed long __s32;
typedef unsigned long __u32; typedef unsigned long __u32;
#ifndef __STRICT_ANSI__
typedef signed long long __s64; typedef signed long long __s64;
typedef unsigned long long __u64; typedef unsigned long long __u64;
#endif
/* /*
* These aren't exported outside the kernel to avoid name space clashes * These aren't exported outside the kernel to avoid name space clashes
......
#ifndef _M68K_BITOPS_H
#define _M68K_BITOPS_H
/*
* Copyright 1992, Linus Torvalds.
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file README.legal in the main directory of this archive
* for more details.
*/
/*
* Require 68020 or better.
*
* They don't use the standard m680x0 bit ordering.
* Instead, the use the standard m680x0 bitfield ordering.
*
* Thus, bit 0 is the MSB of addr; bit 32 is the MSB of (addr+1).
*/
extern __inline__ int set_bit(int nr,void * vaddr)
{
char retval;
__asm__ __volatile__ ("bfset %2@{%1:#1}; sne %0"
: "=d" (retval) : "d" (nr), "a" (vaddr));
return retval;
}
extern __inline__ int clear_bit(int nr, void * vaddr)
{
char retval;
__asm__ __volatile__ ("bfclr %2@{%1:#1}; sne %0"
: "=d" (retval) : "d" (nr), "a" (vaddr));
return retval;
}
extern __inline__ int change_bit(int nr, void * vaddr)
{
char retval;
__asm__ __volatile__ ("bfchg %2@{%1:#1}; sne %0"
: "=d" (retval) : "d" (nr), "a" (vaddr));
return retval;
}
extern __inline__ int test_bit(int nr, const void * vaddr)
{
char retval;
__asm__ __volatile__ ("bftst %2@{%1:#1}; sne %0"
: "=d" (retval) : "d" (nr), "a" (vaddr));
return retval;
}
extern inline int find_first_zero_bit(void * vaddr, unsigned size)
{
unsigned long res;
unsigned long *p;
unsigned long *addr = vaddr;
if (!size)
return 0;
__asm__ __volatile__ (" moveq #-1,d0\n\t"
"1:"
" cmpl %1@+,d0\n\t"
" bne 2f\n\t"
" subql #1,%0\n\t"
" bne 1b\n\t"
" bra 5f\n\t"
"2:"
" movel %1@-,d0\n\t"
" notl d0\n\t"
" bfffo d0{#0,#0},%0\n\t"
"5:"
: "=d" (res), "=a" (p)
: "0" ((size + 31) >> 5), "1" (addr)
: "d0");
return ((p - addr) << 5) + res;
}
static inline int find_next_zero_bit (void *vaddr, int size,
int offset)
{
unsigned long *addr = vaddr;
unsigned long *p = addr + (offset >> 5);
int set = 0, bit = offset & 31, res;
if (bit) {
/* Look for zero in first longword */
__asm__("bfffo %1{#0,#0},%0"
: "=d" (set)
: "d" (~*p << bit));
if (set < (32 - bit))
return set + offset;
set = 32 - bit;
p++;
}
/* No zero yet, search remaining full bytes for a zero */
res = find_first_zero_bit (p, size - 32 * (p - addr));
return (offset + set + res);
}
/*
* ffz = Find First Zero in word. Undefined if no zero exists,
* so code should check against ~0UL first..
*/
extern inline unsigned long ffz(unsigned long word)
{
__asm__ __volatile__ ("bfffo %1{#0,#0},%0"
: "=d" (word)
: "d" (~(word)));
return word;
}
#endif /* _M68K_BITOPS_H */
#ifndef _M68K_DELAY_H
#define _M68K_DELAY_H
/*
* Copyright (C) 1994 Hamish Macdonald
*
* Delay routines, using a pre-computed "loops_per_second" value.
*/
extern __inline__ void __delay(int loops)
{
__asm__("\n\tmovel %0,d0\n1:\tsubql #1,d0\n\tbpls 1b\n"
: /* no outputs */
: "g" (loops)
: "d0");
}
/*
* division by multiplication: you don't have to worry about
* loss of precision.
*
* Use only for very small delays ( < 1 msec). Should probably use a
* lookup table, really, as the multiplications take much too long with
* short delays. This is a "reasonable" implementation, though (and the
* first constant multiplications gets optimized away if the delay is
* a constant)
*/
extern __inline__ void udelay(unsigned long usecs)
{
asm ("mulul %1,d0,%0\n\t"
"divul %2,d0,%0"
: "=d" (usecs)
: "d" (usecs),
"i" (1000000),
"0" (loops_per_sec)
: "d0");
__delay(usecs);
}
#endif /* defined(_M68K_DELAY_H) */
#ifndef _M68K_DMA_H
#define _M68K_DMA_H 1
/* dummy for m68k */
#endif /* _M68K_DMA_H */
#ifndef _M68K_IO_H
#define _M68K_IO_H
static inline unsigned char get_user_byte_io(const char * addr)
{
register unsigned char _v;
__asm__ __volatile__ ("moveb %1,%0":"=r" (_v):"m" (*addr));
return _v;
}
#define inb_p(addr) get_user_byte_io((char *)(addr))
#define inb(addr) get_user_byte_io((char *)(addr))
static inline void put_user_byte_io(char val,char *addr)
{
__asm__ __volatile__ ("moveb %0,%1"
: /* no outputs */
:"r" (val),"m" (*addr)
: "memory");
}
#define outb_p(x,addr) put_user_byte_io((x),(char *)(addr))
#define outb(x,addr) put_user_byte_io((x),(char *)(addr))
#endif /* _M68K_IO_H */
#ifndef _M68K_IRQ_H_
#define _M68K_IRQ_H_
/* dummy for m68k */
#endif /* _M68K_IRQ_H_ */
/*
* linux/include/asm-m68k/segment.h
*
* Copyright (C) 1991, 1992 Linus Torvalds
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file README.legal in the main directory of this archive
* for more details.
*/
/*
* 680x0 support added by Hamish Macdonald
*/
#ifndef _M68K_SEGMENT_H
#define _M68K_SEGMENT_H
static inline unsigned char get_user_byte(const char * addr)
{
register unsigned char _v;
__asm__ __volatile__ ("movesb %1,%0":"=r" (_v):"m" (*addr));
return _v;
}
#define get_fs_byte(addr) get_user_byte((char *)(addr))
static inline unsigned short get_user_word(const short *addr)
{
unsigned short _v;
__asm__ __volatile__ ("movesw %1,%0":"=r" (_v):"m" (*addr));
return _v;
}
#define get_fs_word(addr) get_user_word((short *)(addr))
static inline unsigned long get_user_long(const int *addr)
{
unsigned long _v;
__asm__ __volatile__ ("movesl %1,%0":"=r" (_v):"m" (*addr)); \
return _v;
}
#define get_fs_long(addr) get_user_long((int *)(addr))
static inline void put_user_byte(char val,char *addr)
{
__asm__ __volatile__ ("movesb %0,%1": /* no outputs */ :"r" (val),"m" (*addr) : "memory");
}
#define put_fs_byte(x,addr) put_user_byte((x),(char *)(addr))
static inline void put_user_word(short val,short * addr)
{
__asm__ __volatile__ ("movesw %0,%1": /* no outputs */ :"r" (val),"m" (*addr) : "memory");
}
#define put_fs_word(x,addr) put_user_word((x),(short *)(addr))
static inline void put_user_long(unsigned long val,int * addr)
{
__asm__ __volatile__ ("movesl %0,%1": /* no outputs */ :"r" (val),"m" (*addr) : "memory");
}
#define put_fs_long(x,addr) put_user_long((x),(int *)(addr))
static inline void __generic_memcpy_tofs(void * to, const void * from, unsigned long n)
{
if (n == 0) return;
__asm__ __volatile__ ("1:\n\t"
"moveb %1@+,d0\n\t"
"movesb d0,%2@+\n\t"
"dbra %0,1b\n\t"
"clrw %0\n\t"
"subql #1,%0\n\t"
"bccs 1b"
: "=d" (n), "=a" (from), "=a" (to)
: "1" (from), "2" (to), "0" (n-1)
: "d0", "memory");
}
static inline void __constant_memcpy_tofs(void * to, const void * from, unsigned long n)
{
if (n == 0) {
return;
} else if (n == 1) {
put_user_byte(*(const char *) from, (char *) to);
return;
} else if (n == 2) {
put_user_word(*(const short *) from, (short *) to);
return;
} else if (n == 3) {
put_user_word(*(const short *) from, (short *) to);
put_user_byte(*(2+(const char *) from), 2+(char *) to);
return;
} else if (n == 4) {
put_user_long(*(const int *) from, (int *) to);
return;
}
#if 0
#define COMMON(x) \
__asm__("cld\n\t" \
"push %%es\n\t" \
"push %%fs\n\t" \
"pop %%es\n\t" \
"rep ; movsl\n\t" \
x \
"pop %%es" \
: /* no outputs */ \
:"c" (n/4),"D" ((long) to),"S" ((long) from) \
:"cx","di","si")
switch (n % 4) {
case 0:
COMMON("");
return;
case 1:
COMMON("movsb\n\t");
return;
case 2:
COMMON("movsw\n\t");
return;
case 3:
COMMON("movsw\n\tmovsb\n\t");
return;
}
#undef COMMON
#else
__generic_memcpy_tofs(to,from,n);
#endif
}
static inline void __generic_memcpy_fromfs(void * to, const void * from, unsigned long n)
{
if (n == 0) return;
__asm__ __volatile__ ("1:\n\t"
"movesb %1@+,d0\n\t"
"moveb d0,%2@+\n\t"
"dbra %0,1b\n\t"
"clrw %0\n\t"
"subql #1,%0\n\t"
"bccs 1b"
: "=d" (n), "=a" (from), "=a" (to)
: "1" (from), "2" (to), "0" (n-1)
: "d0", "memory");
}
static inline void __constant_memcpy_fromfs(void * to, const void * from, unsigned long n)
{
if (n == 0) {
return;
} else if (n == 1) {
*(char *)to = get_user_byte((const char *) from);
return;
} else if (n == 2) {
*(short *)to = get_user_word((const short *) from);
return;
} else if (n == 3) {
*(short *) to = get_user_word((const short *) from);
*(2+(char *) to) = get_user_byte(2+(const char *) from);
return;
} else if (n == 4) {
*(int *) to = get_user_long((const int *) from);
return;
}
#if 0
#define COMMON(x) \
__asm__("cld\n\t" \
"rep ; fs ; movsl\n\t" \
x \
: /* no outputs */ \
:"c" (n/4),"D" ((long) to),"S" ((long) from) \
:"cx","di","si","memory")
switch (n % 4) {
case 0:
COMMON("");
return;
case 1:
COMMON("fs ; movsb");
return;
case 2:
COMMON("fs ; movsw");
return;
case 3:
COMMON("fs ; movsw\n\tfs ; movsb");
return;
}
#undef COMMON
#else
__generic_memcpy_fromfs(to,from,n);
#endif
}
#define memcpy_fromfs(to, from, n) \
(__builtin_constant_p(n) ? \
__constant_memcpy_fromfs((to),(from),(n)) : \
__generic_memcpy_fromfs((to),(from),(n)))
#define memcpy_tofs(to, from, n) \
(__builtin_constant_p(n) ? \
__constant_memcpy_tofs((to),(from),(n)) : \
__generic_memcpy_tofs((to),(from),(n)))
/*
* Get/set the SFC/DFC registers for MOVES instructions
*/
static inline unsigned long get_fs(void)
{
unsigned long _v;
__asm__ ("movec dfc,%0":"=r" (_v):);
return _v;
}
static inline unsigned long get_ds(void)
{
/* return the supervisor data space code */
return 0x5;
}
static inline void set_fs(unsigned long val)
{
__asm__ __volatile__ ("movec %0,sfc\n\t"
"movec %0,dfc\n\t"
: /* no outputs */ : "r" (val), "r" (val) : "memory");
}
/* define constants */
/* Address spaces (FC0-FC2) */
#ifndef USER_DS
#define USER_DS (1)
#endif
#ifndef KERNEL_DS
#define KERNEL_DS (5)
#endif
#endif /* _M68K_SEGMENT_H */
#ifndef _M68K_STRING_H_
#define _M68K_STRING_H_
#define __USE_PORTABLE_STRINGS_H_
extern inline char * strcpy(char * dest,const char *src)
{
char *xdest = dest;
__asm__ __volatile__
("1:\tmoveb %1@+,%0@+\n\t"
"bne 1b"
: "=a" (dest), "=a" (src)
: "0" (dest), "1" (src) : "memory");
return xdest;
}
extern inline void * strncpy(char *dest, const void *src, size_t n)
{
char *xdest = dest;
if (n == 0)
return xdest;
__asm__
("1:\tmoveb %1@+,%0@+\n\t"
"beq 2f\n\t"
"subql #1,%3\n\t"
"bne 1b\n\t"
"2:"
: "=a" (dest), "=a" (src), "=d" (n)
: "0" (dest), "1" (src), "2" (n)
: "memory");
return dest;
}
#define __USE_PORTABLE_strcat
#define __USE_PORTABLE_strncat
extern inline int strcmp(const char * cs,const char * ct)
{
char __res;
__asm__
("1:\tmoveb %0@+,%2\n\t" /* get *cs */
"cmpb %1@+,%2\n\t" /* compare a byte */
"bne 2f\n\t" /* not equal, break out */
"tstb %2\n\t" /* at end of cs? */
"bne 1b\n\t" /* no, keep going */
"bra 3f\n\t" /* strings are equal */
"2:\tsubb %1@-,%2\n\t" /* *cs - *ct */
"3:"
: "=a" (cs), "=a" (ct), "=d" (__res)
: "0" (cs), "1" (ct));
return __res;
}
extern inline int strncmp(const char * cs,const char * ct,size_t count)
{
char __res;
if (!count)
return 0;
__asm__
("1:\tmovb %0@+,%3\n\t" /* get *cs */
"cmpb %1@+,%3\n\t" /* compare a byte */
"bne 3f\n\t" /* not equal, break out */
"tstb %3\n\t" /* at end of cs? */
"beq 4f\n\t" /* yes, all done */
"subql #1,%2\n\t" /* no, adjust count */
"bne 1b\n\t" /* more to do, keep going */
"2:\tmoveq #0,%3\n\t" /* strings are equal */
"bra 4f\n\t"
"3:\tsubb %1@-,%3\n\t" /* *cs - *ct */
"4:"
: "=a" (cs), "=a" (ct), "=d" (count), "=d" (__res)
: "0" (cs), "1" (ct), "2" (count));
return __res;
}
#define __USE_PORTABLE_strchr
#define __USE_PORTABLE_strlen
#define __USE_PORTABLE_strspn
#define __USE_PORTABLE_strpbrk
#define __USE_PORTABLE_strtok
extern inline void * memset(void * s,char c,size_t count)
{
void *xs = s;
if (!count)
return xs;
__asm__ __volatile__
("1:\tmoveb %3,%0@+\n\t"
"subql #1,%1\n\t"
"bne 1b"
: "=a" (s), "=d" (count)
: "0" (s), "d" (c), "1" (count)
: "memory");
return xs;
}
extern inline void * memcpy(void * to, const void * from, size_t n)
{
void *xto = to;
if (!n)
return xto;
__asm__ __volatile__
("1:\tmoveb %1@+,%0@+\n\t"
"subql #1,%2\n\t"
"bne 1b"
: "=a" (to), "=a" (from), "=d" (n)
: "0" (to), "1" (from), "2" (n)
: "memory" );
return xto;
}
extern inline void * memmove(void * dest,const void * src, size_t n)
{
void *xdest = dest;
if (!n)
return xdest;
if (dest < src)
__asm__ __volatile__
("1:\tmoveb %1@+,%0@+\n\t"
"subql #1,%2\n\t"
"bne 1b"
: "=a" (dest), "=a" (src), "=d" (n)
: "0" (dest), "1" (src), "2" (n)
: "memory" );
else
__asm__ __volatile__
("1:\tmoveb %1@-,%0@-\n\t"
"subql #1,%2\n\t"
"bne 1b"
: "=a" (dest), "=a" (src), "=d" (n)
: "0" (dest+n), "1" (src+n), "2" (n)
: "memory" );
return xdest;
}
#define __USE_PORTABLE_memcmp
#define __USE_PORTABLE_memscan
#endif /* _M68K_STRING_H_ */
/*
* linux/include/asm-m68k/system.h
*
* Copyright (C) 1991, 1992 Linus Torvalds
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file README.legal in the main directory of this archive
* for more details.
*/
/*
* 680x0 support added by Hamish Macdonald
*/
#ifndef _M68K_SYSTEM_H
#define _M68K_SYSTEM_H
#include <linux/autoconf.h> /* get configuration makros */
#if defined(CONFIG_ATARI) && !defined(CONFIG_AMIGA) && !defined(CONFIG_MAC)
/* block out HSYNC on the atari */
#define sti() __asm__ __volatile__ ("andiw #0xfbff,sr": : : "memory")
#else /* portable version */
#define sti() __asm__ __volatile__ ("andiw #0xf8ff,sr": : : "memory")
#endif /* machine compilation types */
#define cli() __asm__ __volatile__ ("oriw #0x0700,sr": : : "memory")
#define nop() __asm__ __volatile__ ("nop"::)
#define save_flags(x) \
__asm__ __volatile__("movew sr,%0":"=d" (x) : /* no input */ :"memory")
#define restore_flags(x) \
__asm__ __volatile__("movew %0,sr": /* no outputs */ :"d" (x) : "memory")
#define iret() __asm__ __volatile__ ("rte": : :"memory", "sp", "cc")
#define move_to_user_mode() \
__asm__ __volatile__ ("movel sp,usp\n\t" /* setup user sp */ \
"movec %0,msp\n\t" /* setup kernel sp */ \
"andiw #0xdfff,sr" /* return to user mode */ \
: /* no output */ \
: "r" (current->kernel_stack_page + PAGE_SIZE) \
: "memory", "sp")
static inline void clear_fpu(void) {
unsigned long nilstate = 0;
__asm__ __volatile__ ("frestore %0@" : : "a" (&nilstate));
}
#define halt() \
__asm__ __volatile__ ("halt")
#endif /* _M68K_SYSTEM_H */
#ifndef _ASM_M68K_UNISTD_H_
#define _ASM_M68K_UNISTD_H_
/* XXX - _foo needs to be __foo, while __NR_bar could be _NR_bar. */
#define _syscall0(type,name) \
type name(void) \
{ \
register long __res __asm__ ("d0") = __NR_##name; \
__asm__ __volatile__ ("trap #0" \
: "=g" (__res) \
: "0" (__NR_##name) \
: "d0"); \
if (__res >= 0) \
return (type) __res; \
errno = -__res; \
return -1; \
}
#define _syscall1(type,name,atype,a) \
type name(atype a) \
{ \
register long __res __asm__ ("d0") = __NR_##name; \
__asm__ __volatile__ ("movel %2,d1\n\t" \
"trap #0" \
: "=g" (__res) \
: "0" (__NR_##name), "g" ((long)(a)) \
: "d0", "d1"); \
if (__res >= 0) \
return (type) __res; \
errno = -__res; \
return -1; \
}
#define _syscall2(type,name,atype,a,btype,b) \
type name(atype a,btype b) \
{ \
register long __res __asm__ ("d0") = __NR_##name; \
__asm__ __volatile__ ("movel %2,d1\n\t" \
"movel %3,d2\n\t" \
"trap #0" \
: "=g" (__res) \
: "0" (__NR_##name), "g" ((long)(a)), \
"g" ((long)(b)) \
: "d0", "d1", "d2"); \
if (__res >= 0) \
return (type) __res; \
errno = -__res; \
return -1; \
}
#define _syscall3(type,name,atype,a,btype,b,ctype,c) \
type name(atype a,btype b,ctype c) \
{ \
register long __res __asm__ ("d0") = __NR_##name; \
__asm__ __volatile__ ("movel %2,d1\n\t" \
"movel %3,d2\n\t" \
"movel %4,d3\n\t" \
"trap #0" \
: "=g" (__res) \
: "0" (__NR_##name), "g" ((long)(a)), \
"g" ((long)(b)), \
"g" ((long)(c)) \
: "d0", "d1", "d2", "d3"); \
if (__res >= 0) \
return (type) __res; \
errno = -__res; \
return -1; \
}
#define _syscall4(type,name,atype,a,btype,b,ctype,c,dtype,d) \
type name (atype a, btype b, ctype c, dtype d) \
{ \
register long __res __asm__ ("d0") = __NR_##name; \
__asm__ __volatile__ ("movel %2,d1\n\t" \
"movel %3,d2\n\t" \
"movel %4,d3\n\t" \
"movel %5,d4\n\t" \
"trap #0" \
: "=g" (__res) \
: "0" (__NR_##name), "g" ((long)(a)), \
"g" ((long)(b)), \
"g" ((long)(c)), \
"g" ((long)(d)) \
: "d0", "d1", "d2", "d3", "d4"); \
if (__res >= 0) \
return (type) __res; \
errno = -__res; \
return -1; \
}
#define _syscall5(type,name,atype,a,btype,b,ctype,c,dtype,d,etype,e) \
type name (atype a,btype b,ctype c,dtype d,etype e) \
{ \
register long __res __asm__ ("d0") = __NR_##name; \
__asm__ __volatile__ ("movel %2,d1\n\t" \
"movel %3,d2\n\t" \
"movel %4,d3\n\t" \
"movel %5,d4\n\t" \
"movel %6,d5\n\t" \
"trap #0" \
: "=g" (__res) \
: "0" (__NR_##name), "g" ((long)(a)), \
"g" ((long)(b)), \
"g" ((long)(c)), \
"g" ((long)(d)), \
"g" ((long)(e)) \
: "d0", "d1", "d2", "d3", "d4", "d5"); \
if (__res >= 0) \
return (type) __res; \
errno = -__res; \
return -1; \
}
#endif /* _ASM_M68K_UNISTD_H_ */
#ifndef _ELF_H #ifndef _LINUX_ELF_H
#define _ELF_H #define _LINUX_ELF_H
typedef unsigned long Elf32_Addr;
typedef unsigned short Elf32_Half;
typedef unsigned long Elf32_Off;
typedef long Elf32_Sword;
typedef unsigned long Elf32_Word;
/* These constants are for the segment types stored in the image headers */ /* These constants are for the segment types stored in the image headers */
#define PT_NULL 0 #define PT_NULL 0
...@@ -76,13 +82,15 @@ ...@@ -76,13 +82,15 @@
typedef struct dynamic{ typedef struct dynamic{
int d_tag; Elf32_Sword d_tag;
union{ union{
int d_val; Elf32_Sword d_val;
char * d_ptr; Elf32_Addr d_ptr;
} d_un; } d_un;
} Elf32_Dyn; } Elf32_Dyn;
extern Elf32_Dyn _DYNAMIC [];
/* The following are used with relocations */ /* The following are used with relocations */
#define ELF32_R_SYM(x) ((x) >> 8) #define ELF32_R_SYM(x) ((x) >> 8)
#define ELF32_R_TYPE(x) ((x) & 0xff) #define ELF32_R_TYPE(x) ((x) & 0xff)
...@@ -101,53 +109,103 @@ typedef struct dynamic{ ...@@ -101,53 +109,103 @@ typedef struct dynamic{
#define R_386_NUM 11 #define R_386_NUM 11
typedef struct elf32_rel { typedef struct elf32_rel {
unsigned int * offset; Elf32_Addr r_offset;
int info; Elf32_Word r_info;
} Elf32_Rel; } Elf32_Rel;
typedef struct elf32_rela{ typedef struct elf32_rela{
unsigned int * offset; Elf32_Addr r_offset;
int info; Elf32_Word r_info;
int addend; Elf32_Sword r_addend;
} Elf32_Rela; } Elf32_Rela;
typedef struct elf32_sym{ typedef struct elf32_sym{
int st_name; Elf32_Word st_name;
unsigned int st_value; Elf32_Addr st_value;
int st_size; Elf32_Word st_size;
unsigned char st_info; unsigned char st_info;
unsigned char st_other; unsigned char st_other;
short int st_shndx; Elf32_Half st_shndx;
} Elf32_Sym; } Elf32_Sym;
#define EI_NIDENT 16
typedef struct elfhdr{ typedef struct elfhdr{
char e_ident[16]; unsigned char e_ident[EI_NIDENT];
short int e_type; Elf32_Half e_type;
short int e_machine; Elf32_Half e_machine;
int e_version; Elf32_Word e_version;
char *e_entry; /* Entry point */ Elf32_Addr e_entry; /* Entry point */
int e_phoff; Elf32_Off e_phoff;
int e_shoff; Elf32_Off e_shoff;
int e_flags; Elf32_Word e_flags;
short int e_ehsize; Elf32_Half e_ehsize;
short int e_phentsize; Elf32_Half e_phentsize;
short int e_phnum; Elf32_Half e_phnum;
short int e_shentsize; Elf32_Half e_shentsize;
short int e_shnum; Elf32_Half e_shnum;
short int e_shstrndx; Elf32_Half e_shstrndx;
} Elf32_Ehdr; } Elf32_Ehdr;
typedef struct elf_phdr{ typedef struct elf_phdr{
int p_type; Elf32_Word p_type;
int p_offset; Elf32_Off p_offset;
int p_vaddr; Elf32_Addr p_vaddr;
int p_paddr; Elf32_Addr p_paddr;
int p_filesz; Elf32_Word p_filesz;
int p_memsz; Elf32_Word p_memsz;
int p_flags; Elf32_Word p_flags;
int p_align; Elf32_Word p_align;
} Elf32_Phdr; } Elf32_Phdr;
/* sh_type */
#define SHT_NULL 0
#define SHT_PROGBITS 1
#define SHT_SYMTAB 2
#define SHT_STRTAB 3
#define SHT_RELA 4
#define SHT_HASH 5
#define SHT_DYNAMIC 6
#define SHT_NOTE 7
#define SHT_NOBITS 8
#define SHT_REL 9
#define SHT_SHLIB 10
#define SHT_DYNSYM 11
#define SHT_NUM 12
#define SHT_LOPROC 0x70000000
#define SHT_HIPROC 0x7fffffff
#define SHT_LOUSER 0x80000000
#define SHT_HIUSER 0xffffffff
/* sh_flags */
#define SHF_WRITE 0x1
#define SHF_ALLOC 0x2
#define SHF_EXECINSTR 0x4
#define SHF_MASKPROC 0xf0000000
/* special section indexes */
#define SHN_UNDEF 0
#define SHN_LORESERVE 0xff00
#define SHN_LOPROC 0xff00
#define SHN_HIPROC 0xff1f
#define SHN_ABS 0xfff1
#define SHN_COMMON 0xfff2
#define SHN_HIRESERVE 0xffff
typedef struct {
Elf32_Word sh_name;
Elf32_Word sh_type;
Elf32_Word sh_flags;
Elf32_Addr sh_addr;
Elf32_Off sh_offset;
Elf32_Word sh_size;
Elf32_Word sh_link;
Elf32_Word sh_info;
Elf32_Word sh_addralign;
Elf32_Word sh_entsize;
} Elf32_Shdr;
#define ELF_START_MMAP 0x80000000 #define ELF_START_MMAP 0x80000000
#endif #endif /* _LINUX_ELF_H */
...@@ -117,6 +117,7 @@ ...@@ -117,6 +117,7 @@
#define PCI_VENDOR_ID_NCR 0x1000 #define PCI_VENDOR_ID_NCR 0x1000
#define PCI_DEVICE_ID_NCR_53C810 0x0001 #define PCI_DEVICE_ID_NCR_53C810 0x0001
#define PCI_DEVICE_ID_NCR_53C815 0x0004
#define PCI_DEVICE_ID_NCR_53C820 0x0002 #define PCI_DEVICE_ID_NCR_53C820 0x0002
#define PCI_DEVICE_ID_NCR_53C825 0x0003 #define PCI_DEVICE_ID_NCR_53C825 0x0003
......
...@@ -12,6 +12,7 @@ enum root_directory_inos { ...@@ -12,6 +12,7 @@ enum root_directory_inos {
PROC_MEMINFO, PROC_MEMINFO,
PROC_KMSG, PROC_KMSG,
PROC_VERSION, PROC_VERSION,
PROC_CPUINFO,
PROC_SELF, /* will change inode # */ PROC_SELF, /* will change inode # */
PROC_NET, PROC_NET,
#ifdef CONFIG_DEBUG_MALLOC #ifdef CONFIG_DEBUG_MALLOC
......
...@@ -16,6 +16,8 @@ ...@@ -16,6 +16,8 @@
*/ */
extern int hard_math; extern int hard_math;
extern int x86; extern int x86;
extern char x86_vendor_id[13];
extern fdiv_bug;
extern int ignore_irq13; extern int ignore_irq13;
extern int wp_works_ok; /* doesn't work on a 386 */ extern int wp_works_ok; /* doesn't work on a 386 */
extern int hlt_works_ok; /* problems on some 486Dx4's and old 386's */ extern int hlt_works_ok; /* problems on some 486Dx4's and old 386's */
......
...@@ -414,7 +414,7 @@ static void check_fpu(void) ...@@ -414,7 +414,7 @@ static void check_fpu(void)
static double x = 4195835.0; static double x = 4195835.0;
static double y = 3145727.0; static double y = 3145727.0;
unsigned short control_word; unsigned short control_word;
int i; extern int fdiv_bug;
if (!hard_math) { if (!hard_math) {
#ifndef CONFIG_MATH_EMULATION #ifndef CONFIG_MATH_EMULATION
...@@ -458,9 +458,9 @@ static void check_fpu(void) ...@@ -458,9 +458,9 @@ static void check_fpu(void)
"fistpl %0\n\t" "fistpl %0\n\t"
"fwait\n\t" "fwait\n\t"
"fninit" "fninit"
: "=m" (*&i) : "=m" (*&fdiv_bug)
: "m" (*&x), "m" (*&y)); : "m" (*&x), "m" (*&y));
if (!i) { if (!fdiv_bug) {
printk("Ok, fpu using exception 16 error reporting.\n"); printk("Ok, fpu using exception 16 error reporting.\n");
return; return;
......
...@@ -193,7 +193,7 @@ int pcibios_present(void) ...@@ -193,7 +193,7 @@ int pcibios_present(void)
return pcibios_entry ? 1 : 0; return pcibios_entry ? 1 : 0;
} }
int pcibios_find_class_code (unsigned long class_code, unsigned short index, int pcibios_find_class (unsigned long class_code, unsigned short index,
unsigned char *bus, unsigned char *device_fn) unsigned char *bus, unsigned char *device_fn)
{ {
unsigned long bx; unsigned long bx;
......
...@@ -35,7 +35,10 @@ ...@@ -35,7 +35,10 @@
#include <linux/netdevice.h> #include <linux/netdevice.h>
#endif #endif
#ifdef CONFIG_PCI #ifdef CONFIG_PCI
#include <pci.h> #include <linux/pci.h>
#endif
#if defined(CONFIG_MSDOS_FS) && !defined(CONFIG_UMSDOS_FS)
#include <linux/msdos_fs.h>
#endif #endif
#include <asm/irq.h> #include <asm/irq.h>
...@@ -265,6 +268,30 @@ struct symbol_table symbol_table = { 0, 0, 0, /* for stacked module support */ ...@@ -265,6 +268,30 @@ struct symbol_table symbol_table = { 0, 0, 0, /* for stacked module support */
X(chrdev_inode_operations), X(chrdev_inode_operations),
X(blkdev_inode_operations), X(blkdev_inode_operations),
X(read_ahead), X(read_ahead),
X(get_hash_table),
X(get_empty_inode),
X(insert_inode_hash),
#if defined(CONFIG_MSDOS_FS) && !defined(CONFIG_UMSDOS_FS)
/* support for umsdos fs */
X(msdos_create),
X(msdos_file_read),
X(msdos_file_write),
X(msdos_lookup),
X(msdos_mkdir),
X(msdos_put_inode),
X(msdos_put_super),
X(msdos_read_inode),
X(msdos_read_super),
X(msdos_readdir),
X(msdos_rename),
X(msdos_rmdir),
X(msdos_smap),
X(msdos_statfs),
X(msdos_truncate),
X(msdos_unlink),
X(msdos_unlink_umsdos),
X(msdos_write_inode),
#endif
/******************************************************** /********************************************************
* Do not add anything below this line, * Do not add anything below this line,
* as the stacked modules depend on this! * as the stacked modules depend on this!
......
...@@ -173,8 +173,10 @@ asmlinkage int printk(const char *fmt, ...) ...@@ -173,8 +173,10 @@ asmlinkage int printk(const char *fmt, ...)
log_buf[(log_start+log_size) & (LOG_BUF_LEN-1)] = *p; log_buf[(log_start+log_size) & (LOG_BUF_LEN-1)] = *p;
if (log_size < LOG_BUF_LEN) if (log_size < LOG_BUF_LEN)
log_size++; log_size++;
else else {
log_start++; log_start++;
log_start &= LOG_BUF_LEN-1;
}
logged_chars++; logged_chars++;
if (*p == '\n') if (*p == '\n')
break; break;
......
...@@ -70,6 +70,10 @@ unsigned long event = 0; ...@@ -70,6 +70,10 @@ unsigned long event = 0;
*/ */
int hard_math = 0; /* set by boot/head.S */ int hard_math = 0; /* set by boot/head.S */
int x86 = 0; /* set by boot/head.S to 3 or 4 */ int x86 = 0; /* set by boot/head.S to 3 or 4 */
int fdiv_bug = 0; /* set if Pentium(TM) with FP bug */
char x86_vendor_id[13] = "Unknown";
int ignore_irq13 = 0; /* set if exception 16 works */ int ignore_irq13 = 0; /* set if exception 16 works */
int wp_works_ok = 0; /* set if paging hardware honours WP */ int wp_works_ok = 0; /* set if paging hardware honours WP */
int hlt_works_ok = 1; /* set if the "hlt" instruction works */ int hlt_works_ok = 1; /* set if the "hlt" instruction works */
......
...@@ -198,22 +198,23 @@ static inline unsigned long do_gettimeoffset(void) ...@@ -198,22 +198,23 @@ static inline unsigned long do_gettimeoffset(void)
/* /*
* This version of gettimeofday has near microsecond resolution. * This version of gettimeofday has near microsecond resolution.
*/ */
static inline void do_gettimeofday(struct timeval *tv) void do_gettimeofday(struct timeval *tv)
{ {
#ifdef __i386__ unsigned long flags;
save_flags(flags);
cli(); cli();
#ifdef __i386__
*tv = xtime; *tv = xtime;
tv->tv_usec += do_gettimeoffset(); tv->tv_usec += do_gettimeoffset();
if (tv->tv_usec >= 1000000) { if (tv->tv_usec >= 1000000) {
tv->tv_usec -= 1000000; tv->tv_usec -= 1000000;
tv->tv_sec++; tv->tv_sec++;
} }
sti();
#else /* not __i386__ */ #else /* not __i386__ */
cli();
*tv = xtime; *tv = xtime;
sti();
#endif /* not __i386__ */ #endif /* not __i386__ */
restore_flags(flags);
} }
asmlinkage int sys_gettimeofday(struct timeval *tv, struct timezone *tz) asmlinkage int sys_gettimeofday(struct timeval *tv, struct timezone *tz)
......
...@@ -58,6 +58,7 @@ unsigned long high_memory = 0; ...@@ -58,6 +58,7 @@ unsigned long high_memory = 0;
extern unsigned long pg0[1024]; /* page table for 0-4MB for everybody */ extern unsigned long pg0[1024]; /* page table for 0-4MB for everybody */
extern void scsi_mem_init(unsigned long);
extern void sound_mem_init(void); extern void sound_mem_init(void);
extern void die_if_kernel(char *,struct pt_regs *,long); extern void die_if_kernel(char *,struct pt_regs *,long);
extern void show_net_buffers(void); extern void show_net_buffers(void);
...@@ -1197,7 +1198,6 @@ void mem_init(unsigned long start_low_mem, ...@@ -1197,7 +1198,6 @@ void mem_init(unsigned long start_low_mem,
unsigned long tmp; unsigned long tmp;
extern int etext; extern int etext;
cli();
end_mem &= PAGE_MASK; end_mem &= PAGE_MASK;
high_memory = end_mem; high_memory = end_mem;
...@@ -1219,6 +1219,9 @@ void mem_init(unsigned long start_low_mem, ...@@ -1219,6 +1219,9 @@ void mem_init(unsigned long start_low_mem,
mem_map[MAP_NR(start_mem)] = 0; mem_map[MAP_NR(start_mem)] = 0;
start_mem += PAGE_SIZE; start_mem += PAGE_SIZE;
} }
#ifdef CONFIG_SCSI
scsi_mem_init(high_memory);
#endif
#ifdef CONFIG_SOUND #ifdef CONFIG_SOUND
sound_mem_init(); sound_mem_init();
#endif #endif
......
...@@ -371,6 +371,7 @@ void kfree_skb(struct sk_buff *skb, int rw) ...@@ -371,6 +371,7 @@ void kfree_skb(struct sk_buff *skb, int rw)
skb->sk->wmem_alloc-=skb->mem_len; skb->sk->wmem_alloc-=skb->mem_len;
if(!skb->sk->dead) if(!skb->sk->dead)
skb->sk->write_space(skb->sk); skb->sk->write_space(skb->sk);
kfree_skbmem(skb,skb->mem_len);
} }
} }
else else
......
...@@ -61,6 +61,7 @@ ...@@ -61,6 +61,7 @@
* Adam Caldwell : Missing return in SO_DONTROUTE/SO_DEBUG code * Adam Caldwell : Missing return in SO_DONTROUTE/SO_DEBUG code
* Alan Cox : Split IP from generic code * Alan Cox : Split IP from generic code
* Alan Cox : New kfree_skbmem() * Alan Cox : New kfree_skbmem()
* Alan Cox : Make SO_DEBUG superuser only.
* *
* To Fix: * To Fix:
* *
...@@ -133,6 +134,8 @@ int sock_setsockopt(struct sock *sk, int level, int optname, ...@@ -133,6 +134,8 @@ int sock_setsockopt(struct sock *sk, int level, int optname,
return(-ENOPROTOOPT); return(-ENOPROTOOPT);
case SO_DEBUG: case SO_DEBUG:
if(!suser())
return(-EPERM);
sk->debug=val?1:0; sk->debug=val?1:0;
return 0; return 0;
case SO_DONTROUTE: case SO_DONTROUTE:
......
...@@ -275,30 +275,12 @@ static struct sk_buff *tcp_find_established(struct sock *s) ...@@ -275,30 +275,12 @@ static struct sk_buff *tcp_find_established(struct sock *s)
static void tcp_close_pending (struct sock *sk, int timeout) static void tcp_close_pending (struct sock *sk, int timeout)
{ {
unsigned long flags; struct sk_buff *skb;
struct sk_buff *p, *old_p;
save_flags(flags);
cli();
p=skb_peek(&sk->receive_queue);
if(p==NULL)
{
restore_flags(flags);
return;
}
do while ((skb = skb_dequeue(&sk->receive_queue)) != NULL) {
{ tcp_close(skb->sk, timeout);
tcp_close (p->sk, timeout); kfree_skb(skb, FREE_READ);
skb_unlink (p);
old_p = p;
p=p->next;
kfree_skb(old_p, FREE_READ);
} }
while(p!=skb_peek(&sk->receive_queue));
restore_flags(flags);
return; return;
} }
...@@ -2355,8 +2337,8 @@ static void tcp_close(struct sock *sk, int timeout) ...@@ -2355,8 +2337,8 @@ static void tcp_close(struct sock *sk, int timeout)
case TCP_LISTEN: case TCP_LISTEN:
/* we need to drop any sockets which have been connected, /* we need to drop any sockets which have been connected,
but have not yet been accepted. */ but have not yet been accepted. */
tcp_close_pending(sk, timeout);
tcp_set_state(sk,TCP_CLOSE); tcp_set_state(sk,TCP_CLOSE);
tcp_close_pending(sk, timeout);
release_sock(sk); release_sock(sk);
return; return;
case TCP_CLOSE: case TCP_CLOSE:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment