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
#
#
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"
}
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
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
* 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
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
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
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
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
--- /dev/null
+#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
+
--- /dev/null
+#define KERNSIZE 134217728
+#define KERNBASE -134217728
+#define NBPG 4096
+#define UPAGES 2
+#define PROM_BASE -1568768
+
--- /dev/null
+#define WHO_COMPILED_ME "someone@somewhere.domain"
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);
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
*/
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]))
switch (hostdata->chip) {
case 810:
case 815:
+ case 820:
case 825:
hostdata->dstat_sir_intr = NCR53c8x0_dstat_sir_intr;
hostdata->init_save_regs = NULL;
# 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},)
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
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;
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
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;
+ }
+}
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;
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 */
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;
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))
#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",
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;
}
#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:
*/
-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;
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();
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
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:
#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;
}
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;
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();
}
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 *),
up(req->sem);
}
req->dev = -1;
+ wake_up(&wait_for_request);
wake_up(&SCpnt->device->device_wait);
return NULL;
}
}
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)
else
count=0;
sg_free(device->buff,device->buff_len);
+ device->buff = NULL;
device->pending=0;
wake_up(&device->write_wait);
return count;
device->pending=0;
wake_up(&device->write_wait);
sg_free(device->buff,device->buff_len);
+ device->buff = NULL;
return -EWOULDBLOCK;
}
#ifdef DEBUG
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;
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
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
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
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;
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;
* bad '!' which forced address recalculation for
* EVERY character on the current page.
* <middelin@polyware.iaf.nl>
+ *
+ * Danny ter Haar : Some minor additions for cpuinfo
+ * <danny@ow.nl>
*/
#include <linux/types.h>
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)
{
struct task_struct ** p;
extern int get_ksyms_list(char *);
extern int get_irq_list(char *);
extern int get_dma_list(char *);
+extern int get_cpuinfo(char *);
static int get_root_array(char * page, int type)
{
case PROC_MEMINFO:
return get_meminfo(page);
+ case PROC_CPUINFO:
+ return get_cpuinfo(page);
+
case PROC_VERSION:
return get_version(page);
case PROC_DMA:
return get_dma_list(page);
+
}
return -EBADF;
}
{ PROC_MEMINFO, 7, "meminfo" },
{ PROC_KMSG, 4, "kmsg" },
{ PROC_VERSION, 7, "version" },
+ { PROC_CPUINFO, 7, "cpuinfo" },
{ PROC_SELF, 4, "self" }, /* will change inode # */
{ PROC_NET, 3, "net" },
#ifdef CONFIG_DEBUG_MALLOC
#
# Note 2! The CFLAGS definitions are now in the main makefile...
+ifndef CONFIG_SYSV_FS
+CFLAGS := $(CFLAGS) -DMODULE
+endif
+
.c.s:
$(CC) $(CFLAGS) -S $<
.c.o:
#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)
{
if (inode->i_nlink)
panic("Coherent FS: bad super-block size");
if (64 != sizeof (struct sysv_inode))
panic("sysv fs: bad i-node size");
+ MOD_INC_USE_COUNT;
lock_super(sb);
set_blocksize(dev,BLOCK_SIZE);
unlock_super(sb);
if (!silent)
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;
ok:
sb->s_dev = 0;
unlock_super(sb);
printk("SysV FS: cannot read superblock in 1024 byte mode\n");
- return NULL;
+ goto failed;
}
} else {
/* Switch to another block size. Unfortunately, we have to
sb->s_dev = 0;
unlock_super(sb);
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->s_mounted = iget(sb,SYSV_ROOT_INO);
unlock_super(sb);
if (!sb->s_mounted) {
- sysv_put_super(sb);
printk("SysV FS: get root inode failed\n");
+ sysv_put_super(sb);
return NULL;
}
sb->s_dirt = 1;
set_blocksize(sb->s_dev,BLOCK_SIZE);
sb->s_dev = 0;
unlock_super(sb);
+ MOD_DEC_USE_COUNT;
}
void sysv_statfs(struct super_block *sb, struct statfs *buf)
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
#
# Note 2! The CFLAGS definitions are now in the main makefile...
+ifndef CONFIG_XIA_FS
+CFLAGS := $(CFLAGS) -DMODULE
+endif
+
.c.s:
$(CC) $(CFLAGS) -S $<
.c.o:
#include <asm/system.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"
static u_long random_nr;
for(i = 0 ; i < _XIAFS_ZMAP_SLOTS ; i++)
brelse(sb->u.xiafs_sb.s_zmap_buf[i]);
unlock_super(sb);
+ MOD_DEC_USE_COUNT;
}
static struct super_operations xiafs_sops = {
struct xiafs_super_block *sp;
int i, z, dev;
+ MOD_INC_USE_COUNT;
dev=s->s_dev;
lock_super(s);
s->s_dev=0;
unlock_super(s);
printk("XIA-FS: read super_block failed (%s %d)\n", WHERE_ERR);
+ MOD_DEC_USE_COUNT;
return NULL;
}
sp = (struct xiafs_super_block *) bh->b_data;
if (!silent)
printk("VFS: Can't find a xiafs filesystem on dev 0x%04x.\n",
dev);
+ MOD_DEC_USE_COUNT;
return NULL;
}
s->s_blocksize = sp->s_zone_size;
brelse(bh);
set_blocksize(dev, 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) ;
};
s->u.xiafs_sb.s_nzones = sp->s_nzones;
s->s_dev=0;
unlock_super(s);
printk("XIA-FS: read bitmaps failed (%s %d)\n", WHERE_ERR);
+ MOD_DEC_USE_COUNT;
return NULL;
}
brelse (bh);
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
*/
#if ((~0UL) == 0xffffffff)
+#ifndef __STRICT_ANSI__
typedef signed long long __s64;
typedef unsigned long long __u64;
+#endif
#else
"mov %%ax,%%gs" \
: /* 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")
/*
return res;
}
+#define sti() __asm__ __volatile__ ("sti": : :"memory")
+#define cli() __asm__ __volatile__ ("cli": : :"memory")
+
#define save_flags(x) \
__asm__ __volatile__("pushfl ; popl %0":"=r" (x): /* no input */ :"memory")
typedef signed long __s32;
typedef unsigned long __u32;
+#ifndef __STRICT_ANSI__
typedef signed long long __s64;
typedef unsigned long long __u64;
+#endif
/*
* These aren't exported outside the kernel to avoid name space clashes
--- /dev/null
+#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 */
--- /dev/null
+#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) */
--- /dev/null
+#ifndef _M68K_DMA_H
+#define _M68K_DMA_H 1
+
+/* dummy for m68k */
+
+#endif /* _M68K_DMA_H */
--- /dev/null
+#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 */
--- /dev/null
+#ifndef _M68K_IRQ_H_
+#define _M68K_IRQ_H_
+
+/* dummy for m68k */
+
+#endif /* _M68K_IRQ_H_ */
--- /dev/null
+/*
+ * 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 */
--- /dev/null
+#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_ */
--- /dev/null
+/*
+ * 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 */
--- /dev/null
+#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
-#define _ELF_H
+#ifndef _LINUX_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 */
#define PT_NULL 0
typedef struct dynamic{
- int d_tag;
+ Elf32_Sword d_tag;
union{
- int d_val;
- char * d_ptr;
+ Elf32_Sword d_val;
+ Elf32_Addr d_ptr;
} d_un;
} Elf32_Dyn;
+extern Elf32_Dyn _DYNAMIC [];
+
/* The following are used with relocations */
#define ELF32_R_SYM(x) ((x) >> 8)
#define ELF32_R_TYPE(x) ((x) & 0xff)
#define R_386_NUM 11
typedef struct elf32_rel {
- unsigned int * offset;
- int info;
+ Elf32_Addr r_offset;
+ Elf32_Word r_info;
} Elf32_Rel;
typedef struct elf32_rela{
- unsigned int * offset;
- int info;
- int addend;
+ Elf32_Addr r_offset;
+ Elf32_Word r_info;
+ Elf32_Sword r_addend;
} Elf32_Rela;
typedef struct elf32_sym{
- int st_name;
- unsigned int st_value;
- int st_size;
- unsigned char st_info;
- unsigned char st_other;
- short int st_shndx;
+ Elf32_Word st_name;
+ Elf32_Addr st_value;
+ Elf32_Word st_size;
+ unsigned char st_info;
+ unsigned char st_other;
+ Elf32_Half st_shndx;
} Elf32_Sym;
+
+#define EI_NIDENT 16
+
typedef struct elfhdr{
- char e_ident[16];
- short int e_type;
- short int e_machine;
- int e_version;
- char *e_entry; /* Entry point */
- int e_phoff;
- int e_shoff;
- int e_flags;
- short int e_ehsize;
- short int e_phentsize;
- short int e_phnum;
- short int e_shentsize;
- short int e_shnum;
- short int e_shstrndx;
+ unsigned char e_ident[EI_NIDENT];
+ Elf32_Half e_type;
+ Elf32_Half e_machine;
+ Elf32_Word e_version;
+ Elf32_Addr e_entry; /* Entry point */
+ Elf32_Off e_phoff;
+ Elf32_Off e_shoff;
+ Elf32_Word e_flags;
+ Elf32_Half e_ehsize;
+ Elf32_Half e_phentsize;
+ Elf32_Half e_phnum;
+ Elf32_Half e_shentsize;
+ Elf32_Half e_shnum;
+ Elf32_Half e_shstrndx;
} Elf32_Ehdr;
typedef struct elf_phdr{
- int p_type;
- int p_offset;
- int p_vaddr;
- int p_paddr;
- int p_filesz;
- int p_memsz;
- int p_flags;
- int p_align;
+ Elf32_Word p_type;
+ Elf32_Off p_offset;
+ Elf32_Addr p_vaddr;
+ Elf32_Addr p_paddr;
+ Elf32_Word p_filesz;
+ Elf32_Word p_memsz;
+ Elf32_Word p_flags;
+ Elf32_Word p_align;
} 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
-#endif
+#endif /* _LINUX_ELF_H */
#define PCI_VENDOR_ID_NCR 0x1000
#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_53C825 0x0003
PROC_MEMINFO,
PROC_KMSG,
PROC_VERSION,
+ PROC_CPUINFO,
PROC_SELF, /* will change inode # */
PROC_NET,
#ifdef CONFIG_DEBUG_MALLOC
*/
extern int hard_math;
extern int x86;
+extern char x86_vendor_id[13];
+extern fdiv_bug;
extern int ignore_irq13;
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 */
static double x = 4195835.0;
static double y = 3145727.0;
unsigned short control_word;
- int i;
+ extern int fdiv_bug;
if (!hard_math) {
#ifndef CONFIG_MATH_EMULATION
"fistpl %0\n\t"
"fwait\n\t"
"fninit"
- : "=m" (*&i)
+ : "=m" (*&fdiv_bug)
: "m" (*&x), "m" (*&y));
- if (!i) {
+ if (!fdiv_bug) {
printk("Ok, fpu using exception 16 error reporting.\n");
return;
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 long bx;
#include <linux/netdevice.h>
#endif
#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
#include <asm/irq.h>
X(chrdev_inode_operations),
X(blkdev_inode_operations),
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,
* as the stacked modules depend on this!
log_buf[(log_start+log_size) & (LOG_BUF_LEN-1)] = *p;
if (log_size < LOG_BUF_LEN)
log_size++;
- else
+ else {
log_start++;
+ log_start &= LOG_BUF_LEN-1;
+ }
logged_chars++;
if (*p == '\n')
break;
*/
int hard_math = 0; /* set by boot/head.S */
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 wp_works_ok = 0; /* set if paging hardware honours WP */
int hlt_works_ok = 1; /* set if the "hlt" instruction works */
/*
* 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();
+#ifdef __i386__
*tv = xtime;
tv->tv_usec += do_gettimeoffset();
if (tv->tv_usec >= 1000000) {
tv->tv_usec -= 1000000;
tv->tv_sec++;
}
- sti();
#else /* not __i386__ */
- cli();
*tv = xtime;
- sti();
#endif /* not __i386__ */
+ restore_flags(flags);
}
asmlinkage int sys_gettimeofday(struct timeval *tv, struct timezone *tz)
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 die_if_kernel(char *,struct pt_regs *,long);
extern void show_net_buffers(void);
unsigned long tmp;
extern int etext;
- cli();
end_mem &= PAGE_MASK;
high_memory = end_mem;
mem_map[MAP_NR(start_mem)] = 0;
start_mem += PAGE_SIZE;
}
+#ifdef CONFIG_SCSI
+ scsi_mem_init(high_memory);
+#endif
#ifdef CONFIG_SOUND
sound_mem_init();
#endif
skb->sk->wmem_alloc-=skb->mem_len;
if(!skb->sk->dead)
skb->sk->write_space(skb->sk);
+ kfree_skbmem(skb,skb->mem_len);
}
}
else
* Adam Caldwell : Missing return in SO_DONTROUTE/SO_DEBUG code
* Alan Cox : Split IP from generic code
* Alan Cox : New kfree_skbmem()
+ * Alan Cox : Make SO_DEBUG superuser only.
*
* To Fix:
*
return(-ENOPROTOOPT);
case SO_DEBUG:
+ if(!suser())
+ return(-EPERM);
sk->debug=val?1:0;
return 0;
case SO_DONTROUTE:
static void tcp_close_pending (struct sock *sk, int timeout)
{
- unsigned long flags;
- struct sk_buff *p, *old_p;
-
- save_flags(flags);
- cli();
- p=skb_peek(&sk->receive_queue);
-
- if(p==NULL)
- {
- restore_flags(flags);
- return;
- }
+ struct sk_buff *skb;
- do
- {
- tcp_close (p->sk, timeout);
- skb_unlink (p);
- old_p = p;
- p=p->next;
- kfree_skb(old_p, FREE_READ);
+ while ((skb = skb_dequeue(&sk->receive_queue)) != NULL) {
+ tcp_close(skb->sk, timeout);
+ kfree_skb(skb, FREE_READ);
}
- while(p!=skb_peek(&sk->receive_queue));
-
- restore_flags(flags);
return;
}
case TCP_LISTEN:
/* we need to drop any sockets which have been connected,
but have not yet been accepted. */
- tcp_close_pending(sk, timeout);
tcp_set_state(sk,TCP_CLOSE);
+ tcp_close_pending(sk, timeout);
release_sock(sk);
return;
case TCP_CLOSE: