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

Import 1.1.71

parent 00c2e5a7
......@@ -43,18 +43,6 @@ function readln () {
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
#
......@@ -73,17 +61,17 @@ function comment () {
#
function bool () {
ans=""
def=$(eval echo "\${$2:-$3}")
while [ "$ans" != "y" -a "$ans" != "n" ]; do
readln "$1 ($2) [$3] " "$3"
readln "$1 ($2) [$def] " "$def"
done
if [ "$ans" = "y" ]; then
echo " $2 = $2" >>$CONFIG
echo "$2=y" >>$CONFIG
echo "#define $2 1" >>$CONFIG_H
else
echo "# $2 is not set" >>$CONFIG
echo "#undef $2" >>$CONFIG_H
fi
change $2 $3 $ans
eval "$2=$ans"
}
......@@ -95,23 +83,22 @@ function bool () {
function int () {
# Slimier hack to get bash to rescan a line.
ans="x"
def=$(eval echo "\${$2:-$3}")
while [ $[$ans+0] != "$ans" ]; do
readln "$1 ($2) [$3] " "$3"
readln "$1 ($2) [$def] " "$def"
done
echo " $2 = $ans" >>$CONFIG
echo "$2=$ans" >>$CONFIG
echo "#define $2 ($ans)" >>$CONFIG_H
eval "$2=$ans"
}
CONFIG=.tmpconfig
CONFIG_H=.tmpconfig.h
CONFIG_NEW=config.new
trap "rm -f $CONFIG $CONFIG_H $CONFIG_NEW ; exit 1" 1 2
trap "rm -f $CONFIG $CONFIG_H ; exit 1" 1 2
#
# Make sure we start out with a clean slate.
#
cp config.in $CONFIG_NEW
echo "#" > $CONFIG
echo "# Automatically generated make config: don't edit" >> $CONFIG
echo "#" >> $CONFIG
......@@ -122,16 +109,24 @@ echo " */" >> $CONFIG_H
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
if [ "$CONFIG_SOUND" = "y" ] ; then
$MAKE -C drivers/sound config || exit 1
fi
rm -f .config.old
if [ -f .config ]; then
mv .config .config.old
fi
mv .tmpconfig .config
mv .tmpconfig.h include/linux/autoconf.h
mv config.in config.old
mv config.new config.in
echo
echo "The linux kernel is now hopefully configured for your setup."
......
VERSION = 1
PATCHLEVEL = 1
SUBLEVEL = 70
SUBLEVEL = 71
ARCH = i386
......
......@@ -95,8 +95,6 @@ startup_32:
* apply at our cpl of 0 and the stack ought to be aligned already, and
* 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
pushfl # push EFLAGS
popl %eax # get EFLAGS
......@@ -121,26 +119,31 @@ startup_32:
je is486
isnew: pushl %ecx # restore original EFLAGS
popfl
/* get processor type */
movl $1, %eax # Use the CPUID instruction to
.byte 0x0f, 0xa2 # check the processor type
andl $0xf00, %eax # Set _x86 with the family
shrl $8, %eax # returned.
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+
andl $0x80000011,%eax # Save PG,PE,ET
orl $0x50022,%eax # set AM, WP, NE and MP
jmp 2f
is486: pushl %ecx # restore original EFLAGS
popfl
movl %edi,%esp # restore esp
movl %cr0,%eax # 486
andl $0x80000011,%eax # Save PG,PE,ET
orl $0x50022,%eax # set AM, WP, NE and MP
jmp 2f
is386: pushl %ecx # restore original EFLAGS
popfl
movl %edi,%esp # restore esp
movl %cr0,%eax # 386
andl $0x80000011,%eax # Save PG,PE,ET
orl $2,%eax # set MP
......
......@@ -31,9 +31,9 @@ comment 'Networking options'
bool 'TCP/IP networking' CONFIG_INET y
if [ "$CONFIG_INET" "=" "y" ]; then
bool 'IP forwarding/gatewaying' CONFIG_IP_FORWARD n
#bool 'IP multicasting (ALPHA)' CONFIG_IP_MULTICAST n
#bool 'IP firewalling' CONFIG_IP_FIREWALL n
#bool 'IP accounting' CONFIG_IP_ACCT n
bool 'IP multicasting (ALPHA)' CONFIG_IP_MULTICAST n
bool 'IP firewalling' CONFIG_IP_FIREWALL n
bool 'IP accounting' CONFIG_IP_ACCT n
comment '(it is safe to leave these untouched)'
bool 'PC/TCP compatibility mode' CONFIG_INET_PCTCP n
bool 'Reverse ARP' CONFIG_INET_RARP n
......@@ -100,6 +100,7 @@ bool 'Dummy net driver support' CONFIG_DUMMY n
bool 'SLIP (serial line) support' CONFIG_SLIP n
if [ "$CONFIG_SLIP" = "y" ]; then
bool ' CSLIP compressed headers' SL_COMPRESSED y
bool ' 16 channels instead of 4' SL_SLIP_LOTS n
# bool ' SLIP debugging on' SL_DUMP y
fi
bool 'PPP (point-to-point) support' CONFIG_PPP n
......@@ -112,9 +113,6 @@ if [ "$CONFIG_NET_VENDOR_SMC" = "y" ]; then
bool 'SMC Ultra support' CONFIG_ULTRA n
fi
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
if [ "$CONFIG_NET_VENDOR_3COM" = "y" ]; then
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)
bh->b_req = 0;
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);
if ((rw == WRITE && !bh->b_dirt) || (rw == READ && bh->b_uptodate)) {
unlock_buffer(bh);
......
......@@ -180,8 +180,7 @@ endif
net.a: $(NETDRV_OBJS)
rm -f net.a
ar rc net.a $(NETDRV_OBJS)
ranlib net.a
ar rcs net.a $(NETDRV_OBJS)
clean:
rm -f core *.o *.a *.s
......
......@@ -276,16 +276,17 @@ static char scan_scsis_buf[512];
*/
struct pci_chip {
short pci_device_id;
unsigned short pci_device_id;
int chip;
int max_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_53C815, 815, 2, 3},
{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]))
......@@ -413,6 +414,7 @@ static int NCR53c7x0_init (struct Scsi_Host *host) {
switch (hostdata->chip) {
case 810:
case 815:
case 820:
case 825:
hostdata->dstat_sir_intr = NCR53c8x0_dstat_sir_intr;
hostdata->init_save_regs = NULL;
......
......@@ -6,9 +6,6 @@
# 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
ifeq (${CFLAGS},)
......
......@@ -197,6 +197,12 @@ void aha1740_intr_handle(int foo)
continue;
}
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)
scsi_free(SCtmp->host_scribble, 512);
/* Fetch the sense data, and tuck it away, in the required slot. The
......
......@@ -1215,8 +1215,8 @@ int buslogic_detect(Scsi_Host_Template *tpnt)
if (bus_type == 'V' /* 445 */
&& firmware_rev[0] <= '3' /* S */
&& bios != NULL) { /* BIOS enabled */
#if 0
/* ??? Once LNZ's forbidden_addr stuff makes it into the higher
#if 1
/* Now that LNZ's forbidden_addr stuff makes it into the higher
level scsi code, we can use this instead. */
/* Avoid addresses which "mirror" the BIOS for DMA. */
shpnt->forbidden_addr = bios;
......
......@@ -236,6 +236,8 @@ struct Scsi_Host * scsi_register(Scsi_Host_Template * tpnt, int j){
retval->host_wait = NULL;
retval->last_reset = 0;
retval->irq = 0;
retval->forbidden_addr = 0;
retval->forbidden_size = 0;
retval->hostt = tpnt;
retval->next = NULL;
#ifdef DEBUG
......@@ -328,3 +330,21 @@ unsigned int scsi_init()
max_scsi_hosts = count;
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,10 +252,19 @@ struct Scsi_Host
unsigned char n_io_port;
unsigned char irq;
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
initialized, as required.
*/
*/
int this_id;
int can_queue;
......@@ -264,7 +273,7 @@ struct Scsi_Host
unsigned unchecked_isa_dma:1;
/*
True if this host was loaded as a loadable module
*/
*/
unsigned loaded_as_module:1;
int hostdata[0]; /* Used for storage of host specific stuff */
......
......@@ -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 int update_timeout (Scsi_Cmnd *, int);
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_elapsed;
......@@ -525,7 +525,7 @@ static void scan_scsis (struct Scsi_Host * shpnt)
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))
......@@ -537,7 +537,7 @@ static void scsi_times_out (Scsi_Cmnd * SCpnt)
#endif
}
if (!scsi_abort (SCpnt, DID_TIME_OUT))
if (!scsi_abort (SCpnt, DID_TIME_OUT, pid))
return;
case IN_ABORT:
printk("SCSI host %d abort() timed out - resetting\n",
......@@ -837,8 +837,6 @@ static void scsi_request_sense (Scsi_Cmnd * SCpnt)
SCpnt->use_sg = 0;
SCpnt->cmd_len = COMMAND_SIZE(SCpnt->cmnd[0]);
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)
#ifdef DEBUG
printk("In scsi_done(host = %d, result = %06x)\n", host->host_no, result);
#endif
if(SCpnt->flags & WAS_SENSE)
{
SCpnt->use_sg = SCpnt->old_use_sg;
SCpnt->cmd_len = SCpnt->old_cmd_len;
}
switch (host_byte(result))
{
case DID_OK:
......@@ -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;
struct Scsi_Host * host = SCpnt->host;
......@@ -1408,6 +1413,16 @@ int scsi_abort (Scsi_Cmnd * SCpnt, int why)
while(1)
{
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)
{
sti();
......@@ -1436,6 +1451,8 @@ int scsi_abort (Scsi_Cmnd * SCpnt, int why)
SCpnt->pid, SCpnt->host->host_no, (int) SCpnt->target, (int)
SCpnt->lun);
print_command (SCpnt->cmnd);
if (SCpnt->request.dev == -1 || pid != SCpnt->pid)
return 0;
SCpnt->abort_reason = why;
switch(host->hostt->abort(SCpnt)) {
/* We do not know how to abort. Try waiting another
......@@ -1473,6 +1490,7 @@ int scsi_abort (Scsi_Cmnd * SCpnt, int why)
need to adjust timeout */
case SCSI_ABORT_NOT_RUNNING:
SCpnt->internal_timeout &= ~IN_ABORT;
update_timeout(SCpnt, 0);
return 0;
case SCSI_ABORT_ERROR:
default:
......@@ -1513,7 +1531,7 @@ int scsi_reset (Scsi_Cmnd * SCpnt)
#if 0
if (!(SCpnt1->flags & IS_RESETTING) &&
!(SCpnt1->internal_timeout & IN_ABORT))
scsi_abort(SCpnt1, DID_RESET);
scsi_abort(SCpnt1, DID_RESET, SCpnt->pid);
#endif
SCpnt1->flags |= IS_RESETTING;
}
......@@ -1576,7 +1594,7 @@ static void scsi_main_timeout(void)
We must not enter update_timeout with a timeout condition still pending.
*/
int timed_out;
int timed_out, pid;
struct Scsi_Host * host;
Scsi_Cmnd * SCpnt = NULL;
......@@ -1594,9 +1612,10 @@ static void scsi_main_timeout(void)
for(SCpnt = host->host_queue; SCpnt; SCpnt = SCpnt->next)
if (SCpnt->timeout == -1)
{
sti();
SCpnt->timeout = 0;
scsi_times_out(SCpnt);
pid = SCpnt->pid;
sti();
scsi_times_out(SCpnt, SCpnt);
++timed_out;
cli();
}
......
......@@ -510,7 +510,7 @@ typedef struct scsi_cmnd {
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 ,
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
up(req->sem);
}
req->dev = -1;
wake_up(&wait_for_request);
wake_up(&SCpnt->device->device_wait);
return NULL;
}
......
......@@ -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)
{
scsi_free(scsi_generics[dev].buff,scsi_generics[dev].buff_len);
if (scsi_generics[dev].buff != NULL)
scsi_free(scsi_generics[dev].buff,scsi_generics[dev].buff_len);
scsi_generics[dev].buff=NULL;
scsi_generics[dev].pending=0;
}
if (!scsi_generics[dev].users)
......@@ -188,6 +190,7 @@ static int sg_read(struct inode *inode,struct file *filp,char *buf,int count)
else
count=0;
sg_free(device->buff,device->buff_len);
device->buff = NULL;
device->pending=0;
wake_up(&device->write_wait);
return count;
......@@ -266,6 +269,7 @@ static int sg_write(struct inode *inode,struct file *filp,char *buf,int count)
device->pending=0;
wake_up(&device->write_wait);
sg_free(device->buff,device->buff_len);
device->buff = NULL;
return -EWOULDBLOCK;
}
#ifdef DEBUG
......@@ -370,6 +374,7 @@ static void sg_attach(Scsi_Device * SDp)
scsi_generics[i].generic_wait=NULL;
scsi_generics[i].read_wait=NULL;
scsi_generics[i].write_wait=NULL;
scsi_generics[i].buff=NULL;
scsi_generics[i].exclude=0;
scsi_generics[i].pending=0;
scsi_generics[i].timeout=SG_DEFAULT_TIMEOUT;
......
......@@ -36,6 +36,8 @@ FS_SUBDIRS := $(FS_SUBDIRS) nfs
endif
ifdef CONFIG_XIA_FS
FS_SUBDIRS := $(FS_SUBDIRS) xiafs
else
MODULE_FS_SUBDIRS := $(MODULE_FS_SUBDIRS) xiafs
endif
ifdef CONFIG_UMSDOS_FS
FS_SUBDIRS := $(FS_SUBDIRS) umsdos
......@@ -44,6 +46,8 @@ MODULE_FS_SUBDIRS := $(MODULE_FS_SUBDIRS) umsdos
endif
ifdef CONFIG_SYSV_FS
FS_SUBDIRS := $(FS_SUBDIRS) sysv
else
MODULE_FS_SUBDIRS := $(MODULE_FS_SUBDIRS) sysv
endif
ifdef CONFIG_HPFS_FS
FS_SUBDIRS := $(FS_SUBDIRS) hpfs
......@@ -95,7 +99,8 @@ modules_fs:
set -e; for i in $(MODULE_FS_SUBDIRS); do \
test ! -d $$i || \
{ $(MAKE) -C $$i; }; done
(cd ../modules; \
for i in $(MODULE_FS_SUBDIRS); do ln -sf ../fs/$$i/$$i.o .; done)
else
......
......@@ -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)
{
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--) {
if (chrdevs[major].fops == NULL) {
chrdevs[major].name = name;
......@@ -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)
{
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--) {
if (blkdevs[major].fops == NULL) {
blkdevs[major].name = name;
......
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