Commit 734e34f1 authored by Linus Torvalds's avatar Linus Torvalds

Import 2.0.21

parent 5fec1cd9
...@@ -53,7 +53,8 @@ S: University of Calgary ...@@ -53,7 +53,8 @@ S: University of Calgary
S: Calgary, Alberta, Canada S: Calgary, Alberta, Canada
N: Ralf Baechle N: Ralf Baechle
E: ralf@waldorf-gmbh.de E: ralf@gnu.ai.mit.edu
P: 1024/AF7B30C1 CF 97 C2 CC 6D AE A7 FE C8 BA 9C FC 88 DE 32 C3
D: Linux/MIPS port D: Linux/MIPS port
D: Linux/68k hacker D: Linux/68k hacker
S: Hauptstrasse 19 S: Hauptstrasse 19
...@@ -802,10 +803,10 @@ S: Nepean, Ontario ...@@ -802,10 +803,10 @@ S: Nepean, Ontario
S: Canada K2H 6S3 S: Canada K2H 6S3
N: Warner Losh N: Warner Losh
E: imp@boulder.parcplace.com E: imp@village.org
D: Provided OI/OB for Linux, general hacker D: Linux/MIPS Deskstation support, Provided OI/OB for Linux
S: 4909 Pearl East Circle, Suite 200 S: 8786 Niwot Rd
S: Boulder, Colorado 80303 S: Niwot, CO 80503
S: USA S: USA
N: H.J. Lu N: H.J. Lu
...@@ -1407,6 +1408,10 @@ S: Germany ...@@ -1407,6 +1408,10 @@ S: Germany
N: Jeffrey A. Uphoff N: Jeffrey A. Uphoff
E: juphoff@nrao.edu E: juphoff@nrao.edu
E: jeff.uphoff@linux.org E: jeff.uphoff@linux.org
P: 1024/9ED505C5 D7 BB CA AA 10 45 40 1B 16 19 0A C0 38 A0 3E CB
D: Linux Security/Alert mailing lists' moderator/maintainer.
D: NSM (rpc.statd) developer.
D: PAM S/Key module developer.
D: 'dip' contributor. D: 'dip' contributor.
D: AIPS port, astronomical community support. D: AIPS port, astronomical community support.
S: National Radio Astronomy Observatory S: National Radio Astronomy Observatory
......
...@@ -182,6 +182,10 @@ NO_DOOR_LOCKING ...@@ -182,6 +182,10 @@ NO_DOOR_LOCKING
If this is set, the driver will never attempt to lock the door of If this is set, the driver will never attempt to lock the door of
the drive. the drive.
CDROM_NBLOCKS_BUFFER
This sets the size of the buffer to be used for a CDROMREADAUDIO
ioctl. The default is 8.
TEST TEST
This presently enables an additional ioctl which enables a user-mode This presently enables an additional ioctl which enables a user-mode
program to execute an arbitrary packet command. See the source for program to execute an arbitrary packet command. See the source for
...@@ -366,6 +370,7 @@ e. Directory listings are unpredictably truncated, and `dmesg' shows ...@@ -366,6 +370,7 @@ e. Directory listings are unpredictably truncated, and `dmesg' shows
#include <unistd.h> #include <unistd.h>
#include <stdio.h> #include <stdio.h>
#include <linux/cdrom.h> #include <linux/cdrom.h>
#include <linux/ucdrom.h>
int int
...@@ -396,10 +401,10 @@ main (int argc, char **argv) ...@@ -396,10 +401,10 @@ main (int argc, char **argv)
} }
/* load */ /* load */
status = ioctl (fd, CDROMLOADFROMSLOT, x_slot); status = ioctl (fd, CDROM_SELECT_DISC, x_slot);
if (status != 0) { if (status != 0) {
fprintf (stderr, fprintf (stderr,
"%s: CDROMLOADFROMSLOT ioctl failed for `%s': %s\n", "%s: CDROM_SELECT_DISC ioctl failed for `%s': %s\n",
program, device, strerror (errno)); program, device, strerror (errno));
exit (1); exit (1);
} }
......
...@@ -60,7 +60,7 @@ do ...@@ -60,7 +60,7 @@ do
for c in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15; for c in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15;
do do
name=`expr $boardnum \* 16 + $c` name=`expr $boardnum \* 16 + $c`
mknod /dev/cud$name c $DIGI_CUMAJOR $name mknod /dev/cud$name c $DIGICU_MAJOR $name
mknod /dev/ttyD$name c $DIGI_MAJOR $name mknod /dev/ttyD$name c $DIGI_MAJOR $name
done done
boardnum=`expr $boardnum + 1` boardnum=`expr $boardnum + 1`
......
VERSION = 2 VERSION = 2
PATCHLEVEL = 0 PATCHLEVEL = 0
SUBLEVEL = 20 SUBLEVEL = 21
ARCH = i386 ARCH = i386
...@@ -24,9 +24,10 @@ CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \ ...@@ -24,9 +24,10 @@ CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
TOPDIR := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi) TOPDIR := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi)
HPATH = $(TOPDIR)/include HPATH = $(TOPDIR)/include
FINDHPATH = $(HPATH)/asm $(HPATH)/linux $(HPATH)/scsi $(HPATH)/net
HOSTCC =gcc -I$(HPATH) HOSTCC =gcc -I$(HPATH)
HOSTCFLAGS = HOSTCFLAGS =-O2 -fomit-frame-pointer
CROSS_COMPILE = CROSS_COMPILE =
...@@ -38,7 +39,6 @@ AR =$(CROSS_COMPILE)ar ...@@ -38,7 +39,6 @@ AR =$(CROSS_COMPILE)ar
NM =$(CROSS_COMPILE)nm NM =$(CROSS_COMPILE)nm
STRIP =$(CROSS_COMPILE)strip STRIP =$(CROSS_COMPILE)strip
MAKE =make MAKE =make
AWK =gawk
all: do-it-all all: do-it-all
...@@ -327,7 +327,7 @@ mrproper: clean ...@@ -327,7 +327,7 @@ mrproper: clean
rm -f .menuconfig .menuconfig.log rm -f .menuconfig .menuconfig.log
rm -f include/asm rm -f include/asm
rm -f .depend `find . -name .depend -print` rm -f .depend `find . -name .depend -print`
rm -f .hdepend rm -f .hdepend scripts/mkdep
rm -f $(TOPDIR)/include/linux/modversions.h rm -f $(TOPDIR)/include/linux/modversions.h
rm -f $(TOPDIR)/include/linux/modules/* rm -f $(TOPDIR)/include/linux/modules/*
...@@ -344,8 +344,9 @@ backup: mrproper ...@@ -344,8 +344,9 @@ backup: mrproper
sums: sums:
find . -type f -print | sort | xargs sum > .SUMS find . -type f -print | sort | xargs sum > .SUMS
dep-files: archdep .hdepend include/linux/version.h dep-files: scripts/mkdep archdep include/linux/version.h
$(AWK) -f scripts/depend.awk init/*.c > .tmpdepend scripts/mkdep init/*.c > .tmpdepend
scripts/mkdep `find $(FINDHPATH) -follow -name \*.h ! -name modversions.h -print` > .hdepend
set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i fastdep; done set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i fastdep; done
mv .tmpdepend .depend mv .tmpdepend .depend
...@@ -383,7 +384,5 @@ include Rules.make ...@@ -383,7 +384,5 @@ include Rules.make
# This generates dependencies for the .h files. # This generates dependencies for the .h files.
# #
.hdepend: dummy scripts/mkdep: scripts/mkdep.c
rm -f $@ $(HOSTCC) $(HOSTCFLAGS) -o scripts/mkdep scripts/mkdep.c
$(AWK) -f scripts/depend.awk `find $(HPATH) -name \*.h ! -name modversions.h -print` > .$@
mv .$@ $@
...@@ -83,7 +83,7 @@ endif ...@@ -83,7 +83,7 @@ endif
# #
fastdep: dummy fastdep: dummy
if [ -n "$(wildcard *.[chS])" ]; then \ if [ -n "$(wildcard *.[chS])" ]; then \
$(AWK) -f $(TOPDIR)/scripts/depend.awk *.[chS] > .depend; fi $(TOPDIR)/scripts/mkdep *.[chS] > .depend; fi
ifdef ALL_SUB_DIRS ifdef ALL_SUB_DIRS
set -e; for i in $(ALL_SUB_DIRS); do $(MAKE) -C $$i fastdep; done set -e; for i in $(ALL_SUB_DIRS); do $(MAKE) -C $$i fastdep; done
endif endif
......
...@@ -327,8 +327,8 @@ int get_cpuinfo(char * buffer) ...@@ -327,8 +327,8 @@ int get_cpuinfo(char * buffer)
} }
len += sprintf(buffer+len, len += sprintf(buffer+len,
"\nbogomips\t: %lu.%02lu\n", "\nbogomips\t: %lu.%02lu\n",
CD(loops_per_sec)/500000, CD(loops_per_sec+2500)/500000,
(CD(loops_per_sec)/5000) % 100); (CD(loops_per_sec+2500)/5000) % 100);
#ifdef __SMP__ #ifdef __SMP__
} }
} }
......
...@@ -106,6 +106,8 @@ ...@@ -106,6 +106,8 @@
* <jeffml@netcom.com> * <jeffml@netcom.com>
* 3.15a July 9, 1996 -- Improved Sanyo 3 CD changer identification * 3.15a July 9, 1996 -- Improved Sanyo 3 CD changer identification
* 3.16 Jul 28, 1996 -- Fix from Gadi to reduce kernel stack usage for ioctl. * 3.16 Jul 28, 1996 -- Fix from Gadi to reduce kernel stack usage for ioctl.
* 3.17 Sep 17, 1996 -- Tweak audio reads for some drives.
* Start changing CDROMLOADFROMSLOT to CDROM_SELECT_DISC.
* *
* NOTE: Direct audio reads will only work on some types of drive. * NOTE: Direct audio reads will only work on some types of drive.
* So far, i've received reports of success for Sony and Toshiba drives. * So far, i've received reports of success for Sony and Toshiba drives.
...@@ -132,6 +134,7 @@ ...@@ -132,6 +134,7 @@
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/hdreg.h> #include <linux/hdreg.h>
#include <linux/cdrom.h> #include <linux/cdrom.h>
#include <linux/ucdrom.h>
#include <asm/irq.h> #include <asm/irq.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/byteorder.h> #include <asm/byteorder.h>
...@@ -168,6 +171,13 @@ ...@@ -168,6 +171,13 @@
#endif #endif
/* Size of buffer to allocate, in blocks, for audio reads. */
#ifndef CDROM_NBLOCKS_BUFFER
#define CDROM_NBLOCKS_BUFFER 8
#endif
/************************************************************************/ /************************************************************************/
#define SECTOR_SIZE 512 #define SECTOR_SIZE 512
...@@ -1918,7 +1928,7 @@ int cdrom_get_toc_entry (ide_drive_t *drive, int track, ...@@ -1918,7 +1928,7 @@ int cdrom_get_toc_entry (ide_drive_t *drive, int track,
static int static int
cdrom_read_block (ide_drive_t *drive, int format, int lba, cdrom_read_block (ide_drive_t *drive, int format, int lba, int nblocks,
char *buf, int buflen, char *buf, int buflen,
struct atapi_request_sense *reqbuf) struct atapi_request_sense *reqbuf)
{ {
...@@ -1944,7 +1954,12 @@ cdrom_read_block (ide_drive_t *drive, int format, int lba, ...@@ -1944,7 +1954,12 @@ cdrom_read_block (ide_drive_t *drive, int format, int lba,
pc.c[1] = (format << 2); pc.c[1] = (format << 2);
put_unaligned(htonl(lba), (unsigned int *) &pc.c[2]); put_unaligned(htonl(lba), (unsigned int *) &pc.c[2]);
pc.c[8] = 1; /* one block */ pc.c[8] = (nblocks & 0xff);
pc.c[7] = ((nblocks>>8) & 0xff);
pc.c[6] = ((nblocks>>16) & 0xff);
if (format <= 1)
pc.c[9] = 0xf0;
else
pc.c[9] = 0x10; pc.c[9] = 0x10;
stat = cdrom_queue_packet_command (drive, &pc); stat = cdrom_queue_packet_command (drive, &pc);
...@@ -1959,8 +1974,8 @@ cdrom_read_block (ide_drive_t *drive, int format, int lba, ...@@ -1959,8 +1974,8 @@ cdrom_read_block (ide_drive_t *drive, int format, int lba,
"trying opcode 0xd4\n", "trying opcode 0xd4\n",
drive->name); drive->name);
CDROM_CONFIG_FLAGS (drive)->old_readcd = 1; CDROM_CONFIG_FLAGS (drive)->old_readcd = 1;
return cdrom_read_block (drive, format, lba, buf, buflen, return cdrom_read_block (drive, format, lba, nblocks,
reqbuf); buf, buflen, reqbuf);
} }
#endif /* not STANDARD_ATAPI */ #endif /* not STANDARD_ATAPI */
...@@ -2343,19 +2358,25 @@ int ide_cdrom_ioctl (ide_drive_t *drive, struct inode *inode, ...@@ -2343,19 +2358,25 @@ int ide_cdrom_ioctl (ide_drive_t *drive, struct inode *inode,
if (lba < 0 || lba >= toc->capacity) if (lba < 0 || lba >= toc->capacity)
return -EINVAL; return -EINVAL;
buf = (char *) kmalloc (CD_FRAMESIZE_RAW, GFP_KERNEL); buf = (char *) kmalloc (CDROM_NBLOCKS_BUFFER*CD_FRAMESIZE_RAW,
GFP_KERNEL);
if (buf == NULL) if (buf == NULL)
return -ENOMEM; return -ENOMEM;
while (ra.nframes > 0) { while (ra.nframes > 0) {
stat = cdrom_read_block (drive, 1, lba, buf, int this_nblocks = ra.nframes;
CD_FRAMESIZE_RAW, NULL); if (this_nblocks > CDROM_NBLOCKS_BUFFER)
this_nblocks = CDROM_NBLOCKS_BUFFER;
stat = cdrom_read_block
(drive, 1, lba, this_nblocks,
buf, this_nblocks * CD_FRAMESIZE_RAW, NULL);
if (stat) break; if (stat) break;
memcpy_tofs (ra.buf, buf, CD_FRAMESIZE_RAW); memcpy_tofs (ra.buf, buf,
ra.buf += CD_FRAMESIZE_RAW; this_nblocks * CD_FRAMESIZE_RAW);
--ra.nframes; ra.buf += this_nblocks * CD_FRAMESIZE_RAW;
++lba; ra.nframes -= this_nblocks;
lba += this_nblocks;
} }
kfree (buf); kfree (buf);
...@@ -2399,7 +2420,7 @@ int ide_cdrom_ioctl (ide_drive_t *drive, struct inode *inode, ...@@ -2399,7 +2420,7 @@ int ide_cdrom_ioctl (ide_drive_t *drive, struct inode *inode,
if (buf == NULL) if (buf == NULL)
return -ENOMEM; return -ENOMEM;
stat = cdrom_read_block (drive, format, lba, buf, blocksize, stat = cdrom_read_block (drive, format, lba, 1, buf, blocksize,
NULL); NULL);
if (stat == 0) if (stat == 0)
memcpy_tofs ((char *)arg, buf, blocksize); memcpy_tofs ((char *)arg, buf, blocksize);
...@@ -2432,7 +2453,12 @@ int ide_cdrom_ioctl (ide_drive_t *drive, struct inode *inode, ...@@ -2432,7 +2453,12 @@ int ide_cdrom_ioctl (ide_drive_t *drive, struct inode *inode,
return stat; return stat;
} }
case CDROMLOADFROMSLOT: { case CDROMLOADFROMSLOT:
printk ("%s: Use CDROM_SELECT_DISC "
" instead of CDROMLOADFROMSLOT.\n", drive->name);
/* Fall through. */
case CDROM_SELECT_DISC: {
struct atapi_request_sense my_reqbuf; struct atapi_request_sense my_reqbuf;
int stat; int stat;
......
...@@ -6,6 +6,8 @@ ...@@ -6,6 +6,8 @@
* Copyright (C) 1996 Linus Torvalds, Igor Abramov, and Mark Lord * Copyright (C) 1996 Linus Torvalds, Igor Abramov, and Mark Lord
*/ */
#include <linux/config.h>
/* /*
* Shared data/functions for determining best PIO mode for an IDE drive. * Shared data/functions for determining best PIO mode for an IDE drive.
* Most of this stuff originally lived in cmd640.c, and changes to the * Most of this stuff originally lived in cmd640.c, and changes to the
......
...@@ -349,6 +349,10 @@ static void make_request(int major,int rw, struct buffer_head * bh) ...@@ -349,6 +349,10 @@ static void make_request(int major,int rw, struct buffer_head * bh)
} }
/* look for a free request. */ /* look for a free request. */
/* Loop uses two requests, 1 for loop and 1 for the real device.
* Cut max_req in half to avoid running out and deadlocking. */
if (major == LOOP_MAJOR)
max_req >>= 1;
/* /*
* Try to coalesce the new request with old requests * Try to coalesce the new request with old requests
...@@ -508,7 +512,6 @@ void ll_rw_block(int rw, int nr, struct buffer_head * bh[]) ...@@ -508,7 +512,6 @@ void ll_rw_block(int rw, int nr, struct buffer_head * bh[])
for (i = 0; i < nr; i++) { for (i = 0; i < nr; i++) {
if (bh[i]) { if (bh[i]) {
set_bit(BH_Req, &bh[i]->b_state); set_bit(BH_Req, &bh[i]->b_state);
make_request(MAJOR(bh[i]->b_rdev), rw, bh[i]); make_request(MAJOR(bh[i]->b_rdev), rw, bh[i]);
} }
} }
...@@ -528,6 +531,7 @@ void ll_rw_swap_file(int rw, kdev_t dev, unsigned int *b, int nb, char *buf) ...@@ -528,6 +531,7 @@ void ll_rw_swap_file(int rw, kdev_t dev, unsigned int *b, int nb, char *buf)
{ {
int i, j; int i, j;
int buffersize; int buffersize;
int max_req;
unsigned long rsector; unsigned long rsector;
kdev_t rdev; kdev_t rdev;
struct request * req[8]; struct request * req[8];
...@@ -539,10 +543,12 @@ void ll_rw_swap_file(int rw, kdev_t dev, unsigned int *b, int nb, char *buf) ...@@ -539,10 +543,12 @@ void ll_rw_swap_file(int rw, kdev_t dev, unsigned int *b, int nb, char *buf)
" nonexistent block-device\n"); " nonexistent block-device\n");
return; return;
} }
max_req = NR_REQUEST;
switch (rw) { switch (rw) {
case READ: case READ:
break; break;
case WRITE: case WRITE:
max_req = (NR_REQUEST * 2) / 3;
if (is_read_only(dev)) { if (is_read_only(dev)) {
printk(KERN_NOTICE printk(KERN_NOTICE
"Can't swap to read-only device %s\n", "Can't swap to read-only device %s\n",
...@@ -555,6 +561,8 @@ void ll_rw_swap_file(int rw, kdev_t dev, unsigned int *b, int nb, char *buf) ...@@ -555,6 +561,8 @@ void ll_rw_swap_file(int rw, kdev_t dev, unsigned int *b, int nb, char *buf)
} }
buffersize = PAGE_SIZE / nb; buffersize = PAGE_SIZE / nb;
if (major == LOOP_MAJOR)
max_req >>= 1;
for (j=0, i=0; i<nb;) for (j=0, i=0; i<nb;)
{ {
for (; j < 8 && i < nb; j++, i++, buf += buffersize) for (; j < 8 && i < nb; j++, i++, buf += buffersize)
...@@ -572,10 +580,10 @@ void ll_rw_swap_file(int rw, kdev_t dev, unsigned int *b, int nb, char *buf) ...@@ -572,10 +580,10 @@ void ll_rw_swap_file(int rw, kdev_t dev, unsigned int *b, int nb, char *buf)
#endif #endif
if (j == 0) { if (j == 0) {
req[j] = get_request_wait(NR_REQUEST, rdev); req[j] = get_request_wait(max_req, rdev);
} else { } else {
cli(); cli();
req[j] = get_request(NR_REQUEST, rdev); req[j] = get_request(max_req, rdev);
sti(); sti();
if (req[j] == NULL) if (req[j] == NULL)
break; break;
......
...@@ -196,6 +196,7 @@ static int mmap_zero(struct inode * inode, struct file * file, struct vm_area_st ...@@ -196,6 +196,7 @@ static int mmap_zero(struct inode * inode, struct file * file, struct vm_area_st
static int read_full(struct inode * node, struct file * file, char * buf,int count) static int read_full(struct inode * node, struct file * file, char * buf,int count)
{ {
file->f_pos += count;
return count; return count;
} }
......
...@@ -1002,6 +1002,8 @@ static int extract_entropy(struct random_bucket *r, char * buf, ...@@ -1002,6 +1002,8 @@ static int extract_entropy(struct random_bucket *r, char * buf,
nbytes -= i; nbytes -= i;
buf += i; buf += i;
add_timer_randomness(r, &extract_timer_state, nbytes); add_timer_randomness(r, &extract_timer_state, nbytes);
if (to_user && need_resched)
schedule();
} }
/* Wipe data from memory */ /* Wipe data from memory */
...@@ -1229,7 +1231,7 @@ random_ioctl(struct inode * inode, struct file * file, ...@@ -1229,7 +1231,7 @@ random_ioctl(struct inode * inode, struct file * file,
return -EINVAL; return -EINVAL;
size = get_user(p++); size = get_user(p++);
retval = random_write(0, file, (const char *) p, size); retval = random_write(0, file, (const char *) p, size);
if (retval) if (retval < 0)
return retval; return retval;
/* /*
* Add ent_count to entropy_count, limiting the result to be * Add ent_count to entropy_count, limiting the result to be
......
...@@ -312,7 +312,7 @@ static ushort read_eeprom(short ioaddr, int index) ...@@ -312,7 +312,7 @@ static ushort read_eeprom(short ioaddr, int index)
{ {
outw(EEPROM_READ + index, ioaddr + 10); outw(EEPROM_READ + index, ioaddr + 10);
/* Pause for at least 162 us. for the read to take place. */ /* Pause for at least 162 us. for the read to take place. */
udelay (200); udelay (300);
return inw(ioaddr + 12); return inw(ioaddr + 12);
} }
...@@ -326,7 +326,7 @@ static ushort id_read_eeprom(int index) ...@@ -326,7 +326,7 @@ static ushort id_read_eeprom(int index)
outb(EEPROM_READ + index, id_port); outb(EEPROM_READ + index, id_port);
/* Pause for at least 162 us. for the read to take place. */ /* Pause for at least 162 us. for the read to take place. */
udelay (200); udelay (300);
for (bit = 15; bit >= 0; bit--) for (bit = 15; bit >= 0; bit--)
word = (word << 1) + (inb(id_port) & 0x01); word = (word << 1) + (inb(id_port) & 0x01);
......
...@@ -10,7 +10,7 @@ Written by Gerard Roudier <groudier@club-internet.fr> ...@@ -10,7 +10,7 @@ Written by Gerard Roudier <groudier@club-internet.fr>
1. Introduction 1. Introduction
2. Supported chips and SCSI features 2. Supported chips and SCSI features
3. Summary of other supported features 3. Summary of other supported features
4. Memory mapped IO versus normal IO 4. Memory mapped I/O versus normal I/O
5. Tagged command queueing 5. Tagged command queueing
6. Parity checking 6. Parity checking
7. Profiling information 7. Profiling information
...@@ -39,7 +39,7 @@ This driver has been ported from FreeBSD to Linux and is currently ...@@ -39,7 +39,7 @@ This driver has been ported from FreeBSD to Linux and is currently
maintained by: maintained by:
Gerard Roudier <groudier@club-internet.fr> Gerard Roudier <groudier@club-internet.fr>
The original driver has been written for 386bsd and FreeBSD by The original driver has been written for 386bsd and FreeBSD by:
Wolfgang Stanglmeier <wolf@cologne.de> Wolfgang Stanglmeier <wolf@cologne.de>
Stefan Esser <se@mi.Uni-Koeln.de> Stefan Esser <se@mi.Uni-Koeln.de>
...@@ -50,14 +50,14 @@ Information about new chips is available at SYMBIOS web server: ...@@ -50,14 +50,14 @@ Information about new chips is available at SYMBIOS web server:
http://www.symbios.com http://www.symbios.com
This short documentation only describes the features of the NCR53C8XX driver, This short documentation only describes the features of the NCR53C8XX driver,
configuration parameters and control commands available through the proc scsi configuration parameters and control commands available through the proc SCSI
file system read / write operations. file system read / write operations.
This driver has been tested ok with linux/i386 and is currently untested This driver has been tested OK with linux/i386 and is currently untested
under linux/Alpha. If you intend to use this driver under linux/Alpha, just under linux/Alpha. If you intend to use this driver under linux/Alpha, just
try it first with read-only or mounted read-only devices. try it first with read-only or mounted read-only devices.
I am not a native speaker of English and there is probably lots of I am not a native speaker of English and there are probably lots of
mistakes in this README file. Any help will be welcome. mistakes in this README file. Any help will be welcome.
...@@ -68,14 +68,14 @@ The following features are supported for all chips: ...@@ -68,14 +68,14 @@ The following features are supported for all chips:
Synchronous negotiation Synchronous negotiation
Disconnection Disconnection
Tagged command queuing Tagged command queuing
Scsi parity checking SCSI parity checking
Master parity checking Master parity checking
"Wide negotiation" is supported for chips that allow it. "Wide negotiation" is supported for chips that allow it.
The following table shows some characteristics of NCR 8xx family chips: The following table shows some characteristics of NCR 8xx family chips:
On board Supported by Tested with On board Supported by Tested with
Chip SDMS BIOS Wide Ultra Scsi the driver the driver Chip SDMS BIOS Wide Ultra SCSI the driver the driver
---- --------- ---- ---------- ------------ ----------- ---- --------- ---- ---------- ------------ -----------
810 N N N Y Y 810 N N N Y Y
810A N N N Y Y 810A N N N Y Y
...@@ -84,73 +84,73 @@ Chip SDMS BIOS Wide Ultra Scsi the driver the driver ...@@ -84,73 +84,73 @@ Chip SDMS BIOS Wide Ultra Scsi the driver the driver
825A Y Y N Y Not yet 825A Y Y N Y Not yet
875 Y Y Y(1) Y Not yet 875 Y Y Y(1) Y Not yet
(1) Ultra scsi extensions will be supported in a future release of the (1) Ultra SCSI extensions will be supported in a future release of the
driver. driver.
3. Summary of other supported features. 3. Summary of other supported features.
Module: allow to load the driver Module: allow to load the driver
Memory mapped IO: increase performances Memory mapped I/O: increases performance
Profiling information: read operations from the proc scsi file system Profiling information: read operations from the proc SCSI file system
Control commands: write operations to the proc scsi file system Control commands: write operations to the proc SCSI file system
Debugging information: written to syslog (expert only) Debugging information: written to syslog (expert only)
Scatter / gather Scatter / gather
Shared interrupt Shared interrupt
4. Memory mapped IO versus normal IO 4. Memory mapped I/O versus normal I/O
Memory mapped IO have less latency than normal IO. Memory mapped I/O has less latency than normal I/O.
Since linux-1.3.x, memory mapped IO is used rather than normal IO. Since linux-1.3.x, memory mapped I/O is used rather than normal I/O.
Memory mapped IO seems to works fine on most hardware configuration, but some Memory mapped I/O seems to work fine on most hardware configurations, but some
bad designed motherboards may break this feature. poorly designed motherboards may break this feature.
During initialisation phase, the driver first tries to use memory mapped io. During the initialization phase, the driver first tries to use memory mapped
If nothing seems wrong, it will use memory mapped io. I/O. If nothing seems wrong, it will use memory mapped I/O.
If a flaw is detected, it will use normal io. If a flaw is detected, it will use normal I/O.
However, it's possible that memory mapped io does not work properly and the However, it's possible that memory mapped I/O does not work properly and the
driver has not detected the problem. driver has not detected the problem.
The configuration option CONFIG_SCSI_NCR53C8XX_IOMAPPED allow to force the The configuration option CONFIG_SCSI_NCR53C8XX_IOMAPPED forces the
driver to use normal io in all cases. driver to use normal I/O in all cases.
5. Tagged command queueing 5. Tagged command queueing
Some scsi devices donnot support properly tagged command queuing. Some SCSI devices do not properly support tagged command queuing.
A safe configuration can be to not enable tagged command queuing support at A safe configuration is to not enable tagged command queuing support at
boot-up, and to enable support of it with the control command "settags" boot-up, and to enable support of it with the control command "settags"
described further in this text. described further in this text.
Once you are sure that all your devices support properly tagged command queuing, Once you are sure that all your devices properly support tagged command queuing,
you can enable it by default with the CONFIG_SCSI_NCR53C8XX_TAGGED_QUEUE you can enable it by default with the CONFIG_SCSI_NCR53C8XX_TAGGED_QUEUE
configuration option. configuration option.
6. Parity checking 6. Parity checking
The driver supports scsi parity checking and PCI bus master parity checking. The driver supports SCSI parity checking and PCI bus master parity checking.
These features must be enabled in order to ensure safe data transfers. These features must be enabled in order to ensure safe data transfers.
However, some flawed devices or mother boards will have problems with However, some flawed devices or mother boards will have problems with
parity. You can disable parity by choosing first "CONFIG_EXPERIMENTAL". parity. You can disable parity by choosing first "CONFIG_EXPERIMENTAL".
Then, "make config" will allow to set the following configuration options: Then, "make config" will allow to set the following configuration options:
CONFIG_SCSI_NCR53C8XX_DISABLE_PARITY_CHECK (disable scsi parity checking) CONFIG_SCSI_NCR53C8XX_DISABLE_PARITY_CHECK (disable SCSI parity checking)
CONFIG_SCSI_NCR53C8XX_DISABLE_MPARITY_CHECK (disable master parity checking) CONFIG_SCSI_NCR53C8XX_DISABLE_MPARITY_CHECK (disable master parity checking)
7. Profiling information 7. Profiling information
Profiling information are available through the proc scsi file system. Profiling information is available through the proc SCSI file system.
The device associated with a host has the following pathname: The device associated with a host has the following pathname:
/proc/scsi/ncr53c8xx/N (N=0,1,2 ....) /proc/scsi/ncr53c8xx/N (N=0,1,2 ....)
Generally, only 1 board is used on hardware configuration, and the device is: Generally, only 1 board is used on hardware configuration, and that device is:
/proc/scsi/ncr53c8xx/0 /proc/scsi/ncr53c8xx/0
However, if the driver has been made as module, the number of the host is However, if the driver has been made as module, the number of the hosts is
incremented each time the driver is loaded. incremented each time the driver is loaded.
In order to display profiling information, just enter: In order to display profiling information, just enter:
...@@ -175,8 +175,8 @@ Profiling information: ...@@ -175,8 +175,8 @@ Profiling information:
ms_post = 1320 ms_post = 1320
------------------------------------------------------- -------------------------------------------------------
General information is easy to understand. The device id and the General information is easy to understand. The device ID and the
revision id identify the scsi chip as follows: revision ID identify the SCSI chip as follows:
Chip Device id Revision Id Chip Device id Revision Id
---- --------- ----------- ---- --------- -----------
...@@ -188,11 +188,11 @@ Chip Device id Revision Id ...@@ -188,11 +188,11 @@ Chip Device id Revision Id
825A 0x3 >= 0x10 825A 0x3 >= 0x10
875 0xf 875 0xf
The profiling information is updated upon completion of scsi commands. The profiling information is updated upon completion of SCSI commands.
The data structure is allocated and zeroed when the host adapter is A data structure is allocated and zeroed when the host adapter is
attached. So, if the driver is a module, the profile counters are cleared each attached. So, if the driver is a module, the profile counters are cleared each
time the driver is loaded. time the driver is loaded.
The "clearprof" command allow to clear these counters at any time. The "clearprof" command allows you to clear these counters at any time.
The following counters are available: The following counters are available:
("num" prefix means "number of", "ms" means milli-seconds) ("num" prefix means "number of", "ms" means milli-seconds)
...@@ -206,8 +206,8 @@ num_kbytes ...@@ -206,8 +206,8 @@ num_kbytes
Example above: 671 MB transferred Example above: 671 MB transferred
num_disc num_disc
Number of scsi disconnections Number of SCSI disconnections
Example above: 25763 scsi disconnections Example above: 25763 SCSI disconnections
num_break num_break
number of script interruptions (phase mismatch) number of script interruptions (phase mismatch)
...@@ -222,7 +222,7 @@ num_fly ...@@ -222,7 +222,7 @@ num_fly
Example above: 18038 interruptions "on the fly" Example above: 18038 interruptions "on the fly"
ms_setup ms_setup
Elapsed time for scsi commands setups Elapsed time for SCSI commands setups
Example above: 4.94 seconds Example above: 4.94 seconds
ms_data ms_data
...@@ -230,12 +230,12 @@ ms_data ...@@ -230,12 +230,12 @@ ms_data
Example above: 369.94 seconds spent for data transfer Example above: 369.94 seconds spent for data transfer
ms_disc ms_disc
Elapsed time for scsi disconnections Elapsed time for SCSI disconnections
Example above: 183.09 seconds spent disconnected Example above: 183.09 seconds spent disconnected
ms_post ms_post
Elapsed time for command post processing Elapsed time for command post processing
(time from scsi status get to command completion call) (time from SCSI status get to command completion call)
Example above: 1.32 seconds spent for post processing Example above: 1.32 seconds spent for post processing
Due to the 1/100 second tick of the system clock, "ms_post" time may be Due to the 1/100 second tick of the system clock, "ms_post" time may be
...@@ -243,13 +243,13 @@ wrong. ...@@ -243,13 +243,13 @@ wrong.
In the example above, we got 18038 interrupts "on the fly" and only 1673 script In the example above, we got 18038 interrupts "on the fly" and only 1673 script
breaks probably due to disconnections inside a segment of the scatter list. breaks probably due to disconnections inside a segment of the scatter list.
It is an excellent result due to the fact that the driver tries to use small This is an excellent result due to the fact that the driver tries to use small
data segments (512) for the scatter list. The CPU load of this rescatter process data segments (512) for the scatter list. The CPU load of this rescatter process
is acceptable. Unlike other scsi processors, NCR53C8XX controllers do not need is acceptable. Unlike other SCSI processors, NCR53C8XX controllers do not need
large data chunks in order to get better performances, and it seems that it large data chunks in order to get better performance, and it seems that it
is the opposite. is just the opposite.
The scatter/gather algorithm of the middle scsi driver is not optimal for The scatter/gather algorithm of the middle SCSI driver is not optimal for
NCR scsi processors and should be tunable according to host type. NCR SCSI processors and should be tunable according to host type.
You can tune the "wished" segment size for the scatterlist by changing the You can tune the "wished" segment size for the scatterlist by changing the
following "define" in the file ncr53c8xx.h. following "define" in the file ncr53c8xx.h.
...@@ -261,7 +261,7 @@ SCSI_NCR_SEGMENT_SIZE (default: 512) ...@@ -261,7 +261,7 @@ SCSI_NCR_SEGMENT_SIZE (default: 512)
8. Control commands 8. Control commands
Control commands can be sent to the driver with write operations to the Control commands can be sent to the driver with write operations to the
proc scsi file system. The generic command syntax is the following: proc SCSI file system. The generic command syntax is the following:
echo "<verb> <parameters>" >/proc/scsi/ncr53c8xx/0 echo "<verb> <parameters>" >/proc/scsi/ncr53c8xx/0
(assumes controller number is 0) (assumes controller number is 0)
...@@ -311,14 +311,14 @@ Available commands: ...@@ -311,14 +311,14 @@ Available commands:
setdebug <list of debug flags> setdebug <list of debug flags>
Available debug flags: Available debug flags:
alloc: print infos about memory allocations (ccb, lcb) alloc: print info about memory allocations (ccb, lcb)
queue: print infos about insertions into the command start queue queue: print info about insertions into the command start queue
result: print sense data on CHECK CONDITION status result: print sense data on CHECK CONDITION status
scatter: print infos about the scatter process scatter: print info about the scatter process
scripts: print infos about the script binding process scripts: print info about the script binding process
tiny: print minimal debugging information tiny: print minimal debugging information
timing: print timing information of the ncr chip. timing: print timing information of the NCR chip
nego: print information about scsi negotiations nego: print information about SCSI negotiations
phase: print information on script interruptions phase: print information on script interruptions
...@@ -327,38 +327,38 @@ Available commands: ...@@ -327,38 +327,38 @@ Available commands:
clearprof clearprof
The profile counters are automatically cleared when the amount of data The profile counters are automatically cleared when the amount of data
transfered reach 1000 GB in order to avoid overflow. transfered reaches 1000 GB in order to avoid overflow.
The "clearprof" command allow to clear these counters at any time. The "clearprof" command allows you to clear these counters at any time.
9. Configuration parameters 9. Configuration parameters
If the firmware of all your devices is perfect enough, all the features If the firmware of all your devices is perfect enough, all the features
supported by the driver can be enabled at start-up. supported by the driver can be enabled at start-up.
However, if only one has a flaw for some scsi feature, you can disable the However, if only one has a flaw for some SCSI feature, you can disable the
support by the driver of this feature at linux start-up and enable this support by the driver of this feature at linux start-up and enable this
feature after boot-up only for devices that support it safely. feature after boot-up only for devices that support it safely.
CONFIG_SCSI_NCR53C8XX_IOMAPPED (default answer: n) CONFIG_SCSI_NCR53C8XX_IOMAPPED (default answer: n)
Answer "y" if you suspect your mother board to not allow memory mapped IO. Answer "y" if you suspect your mother board to not allow memory mapped I/O.
May slow down a little performances. May slow down performance a little.
CONFIG_SCSI_NCR53C8XX_TAGGED_QUEUE (default answer: n) CONFIG_SCSI_NCR53C8XX_TAGGED_QUEUE (default answer: n)
Answer "y" if you are sure that all your scsi devices that are able to Answer "y" if you are sure that all your SCSI devices that are able to
accept tagged commands will proceed safely. accept tagged commands will proceed safely.
CONFIG_SCSI_NCR53C8XX_FORCE_ASYNCHRONOUS (default answer: n) CONFIG_SCSI_NCR53C8XX_FORCE_ASYNCHRONOUS (default answer: n)
This option allow to force asynchronous transfer mode for all scsi devices. This option forces asynchronous transfer mode for all SCSI devices.
CONFIG_SCSI_NCR53C8XX_FORCE_SYNC_NEGO (default answer: n) CONFIG_SCSI_NCR53C8XX_FORCE_SYNC_NEGO (default answer: n)
Force synchronous negotiation for all scsi-2 devices. Force synchronous negotiation for all SCSI-2 devices.
Some scsi-2 devices do not report this feature in byte 7 of inquiry Some SCSI-2 devices do not report this feature in byte 7 of inquiry
response and however support it properly (TAMARACK scanners for example). response but do support it properly (TAMARACK scanners for example).
CONFIG_SCSI_NCR53C8XX_NO_DISCONNECT (default and only reasonnable answer: n) CONFIG_SCSI_NCR53C8XX_NO_DISCONNECT (default and only reasonnable answer: n)
If you suspect a device of yours to not support properly disconnections, If you suspect a device of yours does not properly support disconnections,
you can answer "y". Then, all scsi devices will never disconnect the bus you can answer "y". Then, all SCSI devices will never disconnect the bus
even while long scsi operations. even while performing long SCSI operations.
10. Some constants and flags of the ncr53c8xx.h header files 10. Some constants and flags of the ncr53c8xx.h header files
...@@ -368,17 +368,17 @@ To change other "defines", you must edit the header file. ...@@ -368,17 +368,17 @@ To change other "defines", you must edit the header file.
Do that only if you know what you are doing. Do that only if you know what you are doing.
SCSI_NCR_IOMAPPED (default: not defined) SCSI_NCR_IOMAPPED (default: not defined)
If defined, normal IO is forced. If defined, normal I/O is forced.
SCSI_NCR_SHARE_IRQ (default: defined) SCSI_NCR_SHARE_IRQ (default: defined)
If defined, request shared irq. If defined, request shared IRQ.
SCSI_NCR_MAX_TAGS (default: 4) SCSI_NCR_MAX_TAGS (default: 4)
Maximum number of simultaneous tagged commands to a device. Maximum number of simultaneous tagged commands to a device.
Can be changed by "settags <target> <maxtags>" Can be changed by "settags <target> <maxtags>"
SCSI_NCR_ALWAYS_SIMPLE_TAG (default: defined) SCSI_NCR_ALWAYS_SIMPLE_TAG (default: defined)
Use SIMPLE TAG for read and write commands Use SIMPLE TAG for read and write commands.
Can be changed by "setorder <ordered|simple|default>" Can be changed by "setorder <ordered|simple|default>"
SCSI_NCR_TAGGED_QUEUE_DISABLED (default: defined) SCSI_NCR_TAGGED_QUEUE_DISABLED (default: defined)
...@@ -389,38 +389,38 @@ SCSI_NCR_NO_DISCONNECT (default: not defined) ...@@ -389,38 +389,38 @@ SCSI_NCR_NO_DISCONNECT (default: not defined)
If defined, targets are not allowed to disconnect. If defined, targets are not allowed to disconnect.
SCSI_NCR_FORCE_SYNC_NEGO (default: not defined) SCSI_NCR_FORCE_SYNC_NEGO (default: not defined)
If defined, synchronous negotiation is tried for all scsi-2 devices. If defined, synchronous negotiation is tried for all SCSI-2 devices.
Can be changed by "setsync <target> <period>" Can be changed by "setsync <target> <period>"
SCSI_NCR_DISABLE_MPARITY_CHECK (default: not defined) SCSI_NCR_DISABLE_MPARITY_CHECK (default: not defined)
If defined, master parity checking is disabled. If defined, master parity checking is disabled.
SCSI_NCR_DISABLE_PARITY_CHECK (default: not defined) SCSI_NCR_DISABLE_PARITY_CHECK (default: not defined)
If defined, scsi parity checking is disabled. If defined, SCSI parity checking is disabled.
SCSI_NCR_PROFILE (default: defined) SCSI_NCR_PROFILE (default: defined)
If defined, profile information are gathered If defined, profiling information is gathered.
SCSI_NCR_MAX_SCATTER (default: 128) SCSI_NCR_MAX_SCATTER (default: 128)
Scatter list size of the driver ccb. Scatter list size of the driver ccb.
SCSI_NCR_SEGMENT_SIZE (default: 512) SCSI_NCR_SEGMENT_SIZE (default: 512)
If defined, the driver try to use scatter segments of this size. If defined, the driver will try to use scatter segments of this size.
If not defined, the Linux scatter list is used as is. If not defined, the Linux scatter list is used as is.
SCSI_NCR_MAX_TARGET (default: 16) SCSI_NCR_MAX_TARGET (default: 16)
Max number of target per host. Max number of targets per host.
SCSI_NCR_MAX_HOST (default: 2) SCSI_NCR_MAX_HOST (default: 2)
Max number of host controllers. Max number of host controllers.
SCSI_NCR_SETTLE_TIME (default: 2) SCSI_NCR_SETTLE_TIME (default: 2)
Number of seconds the driver wait after reset. Number of seconds the driver will wait after reset.
SCSI_NCR_TIMEOUT_ALERT (default: 3) SCSI_NCR_TIMEOUT_ALERT (default: 3)
If a pending command will time out after this amount of seconds, If a pending command will time out after this amount of seconds,
an ordered tag is used for the next command. an ordered tag is used for the next command.
Avoid timeouts for unordered tagged commands. Avoids timeouts for unordered tagged commands.
SCSI_NCR_CAN_QUEUE (default: 7*SCSI_NCR_MAX_TAGS) SCSI_NCR_CAN_QUEUE (default: 7*SCSI_NCR_MAX_TAGS)
Max number of commands that can be queued to a host. Max number of commands that can be queued to a host.
...@@ -432,7 +432,7 @@ SCSI_NCR_SG_TABLESIZE (default: SCSI_NCR_MAX_SCATTER-1) ...@@ -432,7 +432,7 @@ SCSI_NCR_SG_TABLESIZE (default: SCSI_NCR_MAX_SCATTER-1)
Max size of the Linux scatter/gather list. Max size of the Linux scatter/gather list.
SCSI_NCR_MAX_LUN (default: 8) SCSI_NCR_MAX_LUN (default: 8)
Max number of luns per target Max number of LUNs per target.
11. Provided files 11. Provided files
...@@ -474,9 +474,9 @@ Prior to installing the driver, you must untar the distribution, as follow: ...@@ -474,9 +474,9 @@ Prior to installing the driver, you must untar the distribution, as follow:
This install script only supports linux-1.2.13 and linux-1.3.45 to 1.3.100. This install script only supports linux-1.2.13 and linux-1.3.45 to 1.3.100.
This procedure just move the standard driver files to SAVE_53 sub-directory This procedure just moves the standard driver files to SAVE_53 sub-directory
of linux/drivers/scsi, copies the drivers file to that directory and patches of linux/drivers/scsi, copies the drivers file to that directory and patches
the scsi Makefile. the SCSI Makefile.
The standard driver can be restored with Uninstall.ncr53c8xx The standard driver can be restored with Uninstall.ncr53c8xx
If your linux directory is at the standard location If your linux directory is at the standard location
...@@ -497,7 +497,7 @@ The standard driver can be restored with Uninstall.ncr53c8xx ...@@ -497,7 +497,7 @@ The standard driver can be restored with Uninstall.ncr53c8xx
Since release 1.3.90, additionnal configuation parameters Since release 1.3.90, additionnal configuation parameters
have been added for the standard NCR driver. have been added for the standard NCR driver.
Just reply Y or N as you want to these questions; Just reply Y or N as you want to these questions;
The NCR53C8XX driver ignore those parameters. The NCR53C8XX driver ignores those parameters.
If you prefer the standard NCR driver of Linux: If you prefer the standard NCR driver of Linux:
just enter: just enter:
...@@ -509,9 +509,9 @@ The standard driver can be restored with Uninstall.ncr53c8xx ...@@ -509,9 +509,9 @@ The standard driver can be restored with Uninstall.ncr53c8xx
13. Installation procedure for Linux version 2 13. Installation procedure for Linux version 2
This procedure add the driver to the kernel tree. This procedure adds the driver to the kernel tree.
Using "make config" you can choose between the standard driver and the BSD one. Using "make config" you can choose between the standard driver and the BSD one.
It is possible to configure the both drivers as module and to switch from one It is possible to configure both drivers as modules and to switch from one
to the other at run time. to the other at run time.
Take care to unload the current driver module before loading the other one. Take care to unload the current driver module before loading the other one.
...@@ -532,9 +532,9 @@ Take care to unload the current driver module before loading the other one. ...@@ -532,9 +532,9 @@ Take care to unload the current driver module before loading the other one.
14. Control commands under linux-1.2.13 14. Control commands under linux-1.2.13
Profile data and control commands using the proc scsi file system are not Profiling data and control commands using the proc SCSI file system are not
available for linux-1.2.13. available for linux-1.2.13.
The only control command available is "scsitag" which allows to enable The only control command available is "scsitag" which allows you to enable
tagged command queuing support after linux boot-up. tagged command queuing support after linux boot-up.
Tagged command queueing is disabled by default at system startup. Tagged command queueing is disabled by default at system startup.
...@@ -549,19 +549,19 @@ Use "cc -o scsitag scsitag.c" to create the "scsitag" executable. ...@@ -549,19 +549,19 @@ Use "cc -o scsitag scsitag.c" to create the "scsitag" executable.
15.1 Tagged commands with Iomega Jaz device 15.1 Tagged commands with Iomega Jaz device
I never tried such devices, however it has been reported to me the following: I have not tried this device, however it has been reported to me the following:
This device is capable of Tagged command queuing. However while spinning up, This device is capable of Tagged command queuing. However while spinning up,
it rejects Tagged commands. This behaviour is conforms to 6.8.2 of scsi-2 it rejects Tagged commands. This behaviour is conforms to 6.8.2 of SCSI-2
specifications. The current behaviour of the driver in that situation is not specifications. The current behaviour of the driver in that situation is not
satisfying. So do not enable Tagged command queuing for devices that are able satisfying. So do not enable Tagged command queuing for devices that are able
to spin down. to spin down.
The other problems that may appear are timeouts. The only way to avoid timeouts The other problem that may appear is timeouts. The only way to avoid timeouts
seems to edit linux/drivers/scsi/sd.c and to increase the current timeout seems to edit linux/drivers/scsi/sd.c and to increase the current timeout
values. values.
15.2 Tagged command queuing cannot be disabled at run time 15.2 Tagged command queuing cannot be disabled at run time
Once Tagged command queuing has been enabled, the driver will not allow to Once Tagged command queuing has been enabled, the driver will not allow you to
disable this feature ("settags <target> 0" is not supported). disable this feature ("settags <target> 0" is not supported).
This problem is due to some limitations of the code added to the Linux version This problem is due to some limitations of the code added to the Linux version
of the driver. of the driver.
......
...@@ -32,6 +32,8 @@ ...@@ -32,6 +32,8 @@
#ifndef GENERIC_NCR5380_H #ifndef GENERIC_NCR5380_H
#define GENERIC_NCR5380_H #define GENERIC_NCR5380_H
#include <linux/config.h>
#define GENERIC_NCR5380_PUBLIC_RELEASE 1 #define GENERIC_NCR5380_PUBLIC_RELEASE 1
#ifdef NCR53C400 #ifdef NCR53C400
......
...@@ -2116,6 +2116,18 @@ int scsi_reset (Scsi_Cmnd * SCpnt, unsigned int reset_flags) ...@@ -2116,6 +2116,18 @@ int scsi_reset (Scsi_Cmnd * SCpnt, unsigned int reset_flags)
host->last_reset = jiffies; host->last_reset = jiffies;
temp = host->hostt->reset(SCpnt, reset_flags); temp = host->hostt->reset(SCpnt, reset_flags);
/*
This test allows the driver to introduce an additional bus
settle time delay by setting last_reset up to 20 seconds in
the future. In the normal case where the driver does not
modify last_reset, it must be assumed that the actual bus
reset occurred immediately prior to the return to this code,
and so last_reset must be updated to the current time, so
that the delay in internal_cmnd will guarantee at least a
MIN_RESET_DELAY bus settle time.
*/
if ((host->last_reset < jiffies) ||
(host->last_reset > (jiffies + 20 * HZ)))
host->last_reset = jiffies; host->last_reset = jiffies;
} }
else else
...@@ -2125,6 +2137,8 @@ int scsi_reset (Scsi_Cmnd * SCpnt, unsigned int reset_flags) ...@@ -2125,6 +2137,8 @@ int scsi_reset (Scsi_Cmnd * SCpnt, unsigned int reset_flags)
host->last_reset = jiffies; host->last_reset = jiffies;
SCpnt->flags |= (WAS_RESET | IS_RESETTING); SCpnt->flags |= (WAS_RESET | IS_RESETTING);
temp = host->hostt->reset(SCpnt, reset_flags); temp = host->hostt->reset(SCpnt, reset_flags);
if ((host->last_reset < jiffies) ||
(host->last_reset > (jiffies + 20 * HZ)))
host->last_reset = jiffies; host->last_reset = jiffies;
if (!host->block) host->host_busy--; if (!host->block) host->host_busy--;
} }
......
...@@ -428,7 +428,7 @@ static void rw_intr (Scsi_Cmnd *SCpnt) ...@@ -428,7 +428,7 @@ static void rw_intr (Scsi_Cmnd *SCpnt)
SCpnt->host->host_no, (int) SCpnt->channel, SCpnt->host->host_no, (int) SCpnt->channel,
(int) SCpnt->target, (int) SCpnt->lun); (int) SCpnt->target, (int) SCpnt->lun);
print_command(SCpnt->cmnd); print_command(SCpnt->cmnd);
print_sense("sr", SCpnt); print_sense("sd", SCpnt);
SCpnt = end_scsi_request(SCpnt, 0, block_sectors); SCpnt = end_scsi_request(SCpnt, 0, block_sectors);
requeue_sd_request(SCpnt); requeue_sd_request(SCpnt);
return; return;
......
...@@ -859,8 +859,8 @@ void requeue_sr_request (Scsi_Cmnd * SCpnt) ...@@ -859,8 +859,8 @@ void requeue_sr_request (Scsi_Cmnd * SCpnt)
if (count+1 != SCpnt->use_sg) panic("Bad sr request list"); if (count+1 != SCpnt->use_sg) panic("Bad sr request list");
break; break;
}; };
if (((long) sgpnt[count].address) + sgpnt[count].length > ISA_DMA_THRESHOLD && if (((long) sgpnt[count].address) + sgpnt[count].length - 1 >
SCpnt->host->unchecked_isa_dma) { ISA_DMA_THRESHOLD && SCpnt->host->unchecked_isa_dma) {
sgpnt[count].alt_address = sgpnt[count].address; sgpnt[count].alt_address = sgpnt[count].address;
/* We try to avoid exhausting the DMA pool, since it is easier /* We try to avoid exhausting the DMA pool, since it is easier
* to control usage here. In other places we might have a more * to control usage here. In other places we might have a more
......
...@@ -100,21 +100,33 @@ ...@@ -100,21 +100,33 @@
* J.B. Jan 1994. * J.B. Jan 1994.
* *
* *
* Revision: 08/24/1996. by Miroslav Zagorac <zaga@fly.cc.fer.hr> * Revisions by Miroslav Zagorac <zaga@fly.cc.fer.hr>
*
* 08/24/1996.
* *
* Enhancement for wd7000_detect function has been made, so you don't have * Enhancement for wd7000_detect function has been made, so you don't have
* to enter BIOS ROM adress and IO port in initialisation data (see struct * to enter BIOS ROM adress in initialisation data (see struct Config).
* Config). We cannot detect IRQ and DMA for now, so we have to enter them * We cannot detect IRQ, DMA and I/O base address for now, so we have to
* as arguments while wd_7000 is detected. If someone has IRQ and DMA set * enter them as arguments while wd_7000 is detected. If someone has IRQ,
* to some other value, he can enter them in configuration without any * DMA or I/O base address set to some other value, he can enter them in
* problem. Also I wrote a function wd7000_setup, so now you can enter * configuration without any problem. Also I wrote a function wd7000_setup,
* WD-7000 definition as kernel arguments, as in lilo.conf: * so now you can enter WD-7000 definition as kernel arguments,
* as in lilo.conf:
* *
* append="wd7000=IRQ,DMA" * append="wd7000=IRQ,DMA,IO"
* *
* PS: If card BIOS ROM is disabled, function wd7000_detect now will recognize * PS: If card BIOS ROM is disabled, function wd7000_detect now will recognize
* adapter, unlike the old one. Anyway, BIOS ROM from WD7000 adapter is * adapter, unlike the old one. Anyway, BIOS ROM from WD7000 adapter is
* worthless for Linux. :) * useless for Linux. B^)
*
*
* 09/06/1996.
*
* Autodetecting of I/O base address from wd7000_detect function is removed,
* some little bugs removed, etc...
*
* Thanks to Roger Scott for driver debugging.
*
*/ */
#ifdef MODULE #ifdef MODULE
...@@ -234,16 +246,17 @@ static const short wd7000_dma[] = { 5, 6, 7 }; ...@@ -234,16 +246,17 @@ static const short wd7000_dma[] = { 5, 6, 7 };
typedef struct { typedef struct {
int irq; /* IRQ level */ int irq; /* IRQ level */
int dma; /* DMA channel */ int dma; /* DMA channel */
unsigned iobase; /* I/O base address */
} Config; } Config;
/* /*
* Add here your configuration... * Add here your configuration...
*/ */
static const Config configs[] = { static const Config configs[] = {
{ 15, 6 }, /* defaults for single adapter */ { 15, 6, 0x350 }, /* defaults for single adapter */
{ 11, 5 }, /* defaults for second adapter */ { 11, 5, 0x320 }, /* defaults for second adapter */
{ 9, 6 }, /* My configuretion (Zaga) */ { 7, 6, 0x350 }, /* My configuration (Zaga) */
{ -1, -1 } /* Empty slot */ { -1, -1, 0x0 } /* Empty slot */
}; };
#define NUM_CONFIGS (sizeof(configs)/sizeof(Config)) #define NUM_CONFIGS (sizeof(configs)/sizeof(Config))
...@@ -530,6 +543,7 @@ static int freescbs = MAX_SCBS; /* free list counter */ ...@@ -530,6 +543,7 @@ static int freescbs = MAX_SCBS; /* free list counter */
*/ */
static short wd7000_setupIRQ[NUM_CONFIGS]; static short wd7000_setupIRQ[NUM_CONFIGS];
static short wd7000_setupDMA[NUM_CONFIGS]; static short wd7000_setupDMA[NUM_CONFIGS];
static short wd7000_setupIO[NUM_CONFIGS];
static short wd7000_card_num = 0; static short wd7000_card_num = 0;
/* /*
...@@ -541,14 +555,15 @@ static short wd7000_card_num = 0; ...@@ -541,14 +555,15 @@ static short wd7000_card_num = 0;
* Note: You can now set these options from the kernel's "command line". * Note: You can now set these options from the kernel's "command line".
* The syntax is: * The syntax is:
* *
* wd7000=IRQ,DMA * wd7000=IRQ,DMA,IO
* eg: * eg:
* wd7000=15,6 * wd7000=7,6,0x350
* *
* will configure the driver for a WD-7000 controller * will configure the driver for a WD-7000 controller
* using IRQ 15 with a DMA channel 6. * using IRQ 15 with a DMA channel 6, at IO base address 0x350.
*/ */
void wd7000_setup (char *str, int *ints) { void wd7000_setup (char *str, int *ints)
{
short i, j; short i, j;
if (wd7000_card_num >= NUM_CONFIGS) { if (wd7000_card_num >= NUM_CONFIGS) {
...@@ -558,16 +573,17 @@ void wd7000_setup (char *str, int *ints) { ...@@ -558,16 +573,17 @@ void wd7000_setup (char *str, int *ints) {
return; return;
} }
if (ints[0] != 2) if (ints[0] != 3)
printk ("wd7000_setup: Error in command line! " printk ("wd7000_setup: Error in command line! "
"Usage: wd7000=IRQ,DMA\n"); "Usage: wd7000=IRQ,DMA,IO\n");
else { else {
for (i = 0; i < NUM_IRQS; i++) for (i = 0; i < NUM_IRQS; i++)
if (ints[1] == wd7000_irq[i]) if (ints[1] == wd7000_irq[i])
break; break;
if (i == NUM_IRQS) { if (i == NUM_IRQS) {
printk ("wd7000_setup: invalid IRQ.\n"); printk ("wd7000_setup: \"wd7000=%d,%d,0x%x\" -> "
"invalid IRQ.\n", ints[1], ints[2], ints[3]);
return; return;
} }
else else
...@@ -577,29 +593,53 @@ void wd7000_setup (char *str, int *ints) { ...@@ -577,29 +593,53 @@ void wd7000_setup (char *str, int *ints) {
if (ints[2] == wd7000_dma[i]) if (ints[2] == wd7000_dma[i])
break; break;
if (i == NUM_IRQS) { if (i == NUM_DMAS) {
printk ("wd7000_setup: invalid DMA channel.\n"); printk ("wd7000_setup: \"wd7000=%d,%d,0x%x\" -> "
"invalid DMA channel.\n", ints[1], ints[2], ints[3]);
return; return;
} }
else else
wd7000_setupDMA[wd7000_card_num] = ints[2]; wd7000_setupDMA[wd7000_card_num] = ints[2];
for (i = 0; i < NUM_IOPORTS; i++)
if (ints[3] == wd7000_iobase[i])
break;
if (i == NUM_IOPORTS) {
printk ("wd7000_setup: \"wd7000=%d,%d,0x%x\" -> "
"invalid I/O base address.\n", ints[1], ints[2], ints[3]);
return;
}
else
wd7000_setupIO[wd7000_card_num] = ints[3];
if (wd7000_card_num) if (wd7000_card_num)
for (i = 0; i < (wd7000_card_num - 1); i++) for (i = 0; i < (wd7000_card_num - 1); i++)
for (j = i + 1; j < wd7000_card_num; j++) for (j = i + 1; j < wd7000_card_num; j++)
if (wd7000_setupIRQ[i] == wd7000_setupIRQ[j]) { if (wd7000_setupIRQ[i] == wd7000_setupIRQ[j]) {
printk ("wd7000_setup: duplicated IRQ!\n"); printk ("wd7000_setup: \"wd7000=%d,%d,0x%x\" -> "
"duplicated IRQ!\n",
ints[1], ints[2], ints[3]);
return; return;
} }
else if (wd7000_setupDMA[i] == wd7000_setupDMA[j]) { else if (wd7000_setupDMA[i] == wd7000_setupDMA[j]) {
printk ("wd7000_setup: duplicated DMA channel!\n"); printk ("wd7000_setup: \"wd7000=%d,%d,0x%x\" -> "
"duplicated DMA channel!\n",
ints[1], ints[2], ints[3]);
return;
}
else if (wd7000_setupIO[i] == wd7000_setupIO[j]) {
printk ("wd7000_setup: \"wd7000=%d,%d,0x%x\" -> "
"duplicated I/O base address!\n",
ints[1], ints[2], ints[3]);
return; return;
} }
#ifdef DEBUG #ifdef DEBUG
printk ("wd7000_setup: IRQ=%d, DMA=%d\n", printk ("wd7000_setup: IRQ=%d, DMA=%d, I/O=0x%x\n",
wd7000_setupIRQ[wd7000_card_num], wd7000_setupIRQ[wd7000_card_num],
wd7000_setupDMA[wd7000_card_num]); wd7000_setupDMA[wd7000_card_num],
wd7000_setupIO[wd7000_card_num]);
#endif #endif
wd7000_card_num++; wd7000_card_num++;
...@@ -675,17 +715,21 @@ static inline void wd7000_enable_dma(Adapter *host) ...@@ -675,17 +715,21 @@ static inline void wd7000_enable_dma(Adapter *host)
#define WAITnexttimeout 200 /* 2 seconds */ #define WAITnexttimeout 200 /* 2 seconds */
#define WAIT(port, mask, allof, noneof) \ static inline short WAIT (unsigned port, unsigned mask, unsigned allof, unsigned noneof)
{ register volatile unsigned WAITbits; \ {
register unsigned long WAITtimeout = jiffies + WAITnexttimeout; \ register unsigned WAITbits;
while (1) { \ register unsigned long WAITtimeout = jiffies + WAITnexttimeout;
WAITbits = inb(port) & (mask); \
if ((WAITbits & (allof)) == (allof) && ((WAITbits & (noneof)) == 0)) \ while (jiffies <= WAITtimeout) {
break; \ WAITbits = inb (port) & mask;
if (jiffies > WAITtimeout) goto fail; \
} \ if (((WAITbits & allof) == allof) && ((WAITbits & noneof) == 0))
return (0);
} }
return (1);
}
static inline void delay( unsigned how_long ) static inline void delay( unsigned how_long )
{ {
...@@ -697,17 +741,19 @@ static inline void delay( unsigned how_long ) ...@@ -697,17 +741,19 @@ static inline void delay( unsigned how_long )
static inline int command_out(Adapter *host, unchar *cmd, int len) static inline int command_out(Adapter *host, unchar *cmd, int len)
{ {
WAIT(host->iobase+ASC_STAT,ASC_STATMASK,CMD_RDY,0); if (! WAIT (host->iobase+ASC_STAT,ASC_STATMASK,CMD_RDY,0)) {
while (len--) { while (len--) {
do { do {
outb(*cmd, host->iobase+ASC_COMMAND); outb(*cmd, host->iobase+ASC_COMMAND);
WAIT(host->iobase+ASC_STAT, ASC_STATMASK, CMD_RDY, 0); WAIT(host->iobase+ASC_STAT, ASC_STATMASK, CMD_RDY, 0);
} while (inb(host->iobase+ASC_STAT) & CMD_REJ); } while (inb(host->iobase+ASC_STAT) & CMD_REJ);
cmd++; cmd++;
} }
return 1; return 1;
}
fail:
printk("wd7000 command_out: WAIT failed(%d)\n", len+1); printk("wd7000 command_out: WAIT failed(%d)\n", len+1);
return 0; return 0;
} }
...@@ -921,7 +967,7 @@ int make_code(unsigned hosterr, unsigned scsierr) ...@@ -921,7 +967,7 @@ int make_code(unsigned hosterr, unsigned scsierr)
static void wd7000_scsi_done(Scsi_Cmnd * SCpnt) static void wd7000_scsi_done(Scsi_Cmnd * SCpnt)
{ {
#ifdef DEBUG #ifdef DEBUG
printk("wd7000_scsi_done: 0x%06x\n",(long) SCpnt); printk ("wd7000_scsi_done: 0x%06lx\n", (long) SCpnt);
#endif #endif
SCpnt->SCp.phase = 0; SCpnt->SCp.phase = 0;
} }
...@@ -1121,14 +1167,18 @@ int wd7000_init( Adapter *host ) ...@@ -1121,14 +1167,18 @@ int wd7000_init( Adapter *host )
int diag; int diag;
/* /*
Reset the adapter - only. The SCSI bus was initialized at power-up, * Reset the adapter - only. The SCSI bus was initialized at power-up,
and we need to do this just so we control the mailboxes, etc. * and we need to do this just so we control the mailboxes, etc.
*/ */
outb(ASC_RES, host->iobase+ASC_CONTROL); outb(ASC_RES, host->iobase+ASC_CONTROL);
delay(1); /* reset pulse: this is 10ms, only need 25us */ delay(1); /* reset pulse: this is 10ms, only need 25us */
outb(0,host->iobase+ASC_CONTROL); outb(0,host->iobase+ASC_CONTROL);
host->control = 0; /* this must always shadow ASC_CONTROL */ host->control = 0; /* this must always shadow ASC_CONTROL */
WAIT(host->iobase+ASC_STAT, ASC_STATMASK, CMD_RDY, 0);
if (WAIT (host->iobase+ASC_STAT, ASC_STATMASK, CMD_RDY, 0)) {
printk ("wd7000_init: WAIT timed out.\n");
return 0; /* 0 = not ok */
}
if ((diag = inb(host->iobase+ASC_INTR_STAT)) != 1) { if ((diag = inb(host->iobase+ASC_INTR_STAT)) != 1) {
printk("wd7000_init: "); printk("wd7000_init: ");
...@@ -1167,7 +1217,11 @@ int wd7000_init( Adapter *host ) ...@@ -1167,7 +1217,11 @@ int wd7000_init( Adapter *host )
printk("wd7000_init: adapter initialization failed.\n"); printk("wd7000_init: adapter initialization failed.\n");
return 0; return 0;
} }
WAIT(host->iobase+ASC_STAT, ASC_STATMASK, ASC_INIT, 0);
if (WAIT (host->iobase+ASC_STAT, ASC_STATMASK, ASC_INIT, 0)) {
printk ("wd7000_init: WAIT timed out.\n");
return 0;
}
if (request_irq(host->irq, wd7000_intr_handle, SA_INTERRUPT, "wd7000", NULL)) { if (request_irq(host->irq, wd7000_intr_handle, SA_INTERRUPT, "wd7000", NULL)) {
printk("wd7000_init: can't get IRQ %d.\n", host->irq); printk("wd7000_init: can't get IRQ %d.\n", host->irq);
...@@ -1188,10 +1242,6 @@ int wd7000_init( Adapter *host ) ...@@ -1188,10 +1242,6 @@ int wd7000_init( Adapter *host )
} }
return 1; return 1;
fail:
printk("wd7000_init: WAIT timed out.\n");
return 0; /* 0 = not ok */
} }
...@@ -1226,8 +1276,9 @@ void wd7000_revision(Adapter *host) ...@@ -1226,8 +1276,9 @@ void wd7000_revision(Adapter *host)
*/ */
int wd7000_detect (Scsi_Host_Template *tpnt) int wd7000_detect (Scsi_Host_Template *tpnt)
{ {
short present = 0, biosaddr_ptr, iobase_ptr, cfg_ptr, sig_ptr, i; short present = 0, biosaddr_ptr, cfg_ptr, sig_ptr, i, pass;
short biosptr[NUM_CONFIGS]; short biosptr[NUM_CONFIGS];
unsigned iobase;
Adapter *host = NULL; Adapter *host = NULL;
struct Scsi_Host *sh; struct Scsi_Host *sh;
...@@ -1240,14 +1291,14 @@ int wd7000_detect (Scsi_Host_Template *tpnt) ...@@ -1240,14 +1291,14 @@ int wd7000_detect (Scsi_Host_Template *tpnt)
*/ */
init_scbs (); init_scbs ();
for (cfg_ptr = 0; cfg_ptr < NUM_CONFIGS; cfg_ptr++) { for (pass = 0, cfg_ptr = 0; pass < NUM_CONFIGS; pass++) {
for (biosaddr_ptr = 0; biosaddr_ptr < NUM_ADDRS; biosaddr_ptr++) for (biosaddr_ptr = 0; biosaddr_ptr < NUM_ADDRS; biosaddr_ptr++)
for (sig_ptr = 0; sig_ptr < NUM_SIGNATURES; sig_ptr++) { for (sig_ptr = 0; sig_ptr < NUM_SIGNATURES; sig_ptr++) {
for (i = 0; i < cfg_ptr; i++) for (i = 0; i < pass; i++)
if (biosptr[i] == biosaddr_ptr) if (biosptr[i] == biosaddr_ptr)
break; break;
if ((i == cfg_ptr) && if ((i == pass) &&
!memcmp ((void *) (wd7000_biosaddr[biosaddr_ptr] + !memcmp ((void *) (wd7000_biosaddr[biosaddr_ptr] +
signatures[sig_ptr].ofs), signatures[sig_ptr].sig, signatures[sig_ptr].ofs), signatures[sig_ptr].sig,
signatures[sig_ptr].len)) signatures[sig_ptr].len))
...@@ -1257,7 +1308,7 @@ int wd7000_detect (Scsi_Host_Template *tpnt) ...@@ -1257,7 +1308,7 @@ int wd7000_detect (Scsi_Host_Template *tpnt)
bios_matched: bios_matched:
#ifdef DEBUG #ifdef DEBUG
printk ("wd7000_detect: pass %d\n", cfg_ptr + 1); printk ("wd7000_detect: pass %d\n", pass + 1);
if (biosaddr_ptr == NUM_ADDRS) if (biosaddr_ptr == NUM_ADDRS)
printk ("WD-7000 SST BIOS not detected...\n"); printk ("WD-7000 SST BIOS not detected...\n");
...@@ -1266,18 +1317,45 @@ int wd7000_detect (Scsi_Host_Template *tpnt) ...@@ -1266,18 +1317,45 @@ int wd7000_detect (Scsi_Host_Template *tpnt)
wd7000_biosaddr[biosaddr_ptr]); wd7000_biosaddr[biosaddr_ptr]);
#endif #endif
for (iobase_ptr = 0; iobase_ptr < NUM_IOPORTS; iobase_ptr++) if (wd7000_card_num)
if (! check_region (wd7000_iobase[iobase_ptr], 4)) { iobase = wd7000_setupIO[wd7000_card_num - 1];
else {
if (configs[cfg_ptr++].irq < 0)
continue;
iobase = configs[cfg_ptr - 1].iobase;
}
#ifdef DEBUG
printk ("wd7000_detect: check IO 0x%x region...\n", iobase);
#endif
if (! check_region (iobase, 4)) {
#ifdef DEBUG
printk ("wd7000_detect: ASC reset (IO 0x%x) ...", iobase);
#endif
/* /*
* ASC reset... * ASC reset...
*/ */
outb (ASC_RES, wd7000_iobase[iobase_ptr] + ASC_CONTROL); outb (ASC_RES, iobase + ASC_CONTROL);
delay (1); delay (1);
outb (0, wd7000_iobase[iobase_ptr] + ASC_CONTROL); outb (0, iobase + ASC_CONTROL);
WAIT (wd7000_iobase[iobase_ptr] + ASC_STAT, ASC_STATMASK,
CMD_RDY, 0);
if (inb (wd7000_iobase[iobase_ptr] + ASC_INTR_STAT) == 1) { if (WAIT (iobase + ASC_STAT, ASC_STATMASK, CMD_RDY, 0))
#ifdef DEBUG
{
printk ("failed!\n");
continue;
}
else
printk ("ok!\n");
#else
continue;
#endif
if (inb (iobase + ASC_INTR_STAT) == 1) {
/* /*
* We register here, to get a pointer to the extra space, * We register here, to get a pointer to the extra space,
* which we'll use as the Adapter structure (host) for * which we'll use as the Adapter structure (host) for
...@@ -1300,12 +1378,12 @@ int wd7000_detect (Scsi_Host_Template *tpnt) ...@@ -1300,12 +1378,12 @@ int wd7000_detect (Scsi_Host_Template *tpnt)
host->dma = wd7000_setupDMA[wd7000_card_num]; host->dma = wd7000_setupDMA[wd7000_card_num];
} }
else { else {
host->irq = configs[cfg_ptr].irq; host->irq = configs[cfg_ptr - 1].irq;
host->dma = configs[cfg_ptr].dma; host->dma = configs[cfg_ptr - 1].dma;
} }
host->sh = sh; host->sh = sh;
host->iobase = wd7000_iobase[iobase_ptr]; host->iobase = iobase;
irq2host[host->irq] = host; irq2host[host->irq] = host;
#ifdef DEBUG #ifdef DEBUG
...@@ -1340,17 +1418,21 @@ int wd7000_detect (Scsi_Host_Template *tpnt) ...@@ -1340,17 +1418,21 @@ int wd7000_detect (Scsi_Host_Template *tpnt)
present++; /* count it */ present++; /* count it */
if (biosaddr_ptr != NUM_ADDRS) if (biosaddr_ptr != NUM_ADDRS)
biosptr[cfg_ptr] = biosaddr_ptr; biosptr[pass] = biosaddr_ptr;
printk ("Western Digital WD-7000 (rev %d.%d) ", printk ("Western Digital WD-7000 (rev %d.%d) ",
host->rev1, host->rev2); host->rev1, host->rev2);
printk ("using IO 0x%xh, IRQ %d, DMA %d.\n", printk ("using IO 0x%x, IRQ %d, DMA %d.\n",
host->iobase, host->irq, host->dma); host->iobase, host->irq, host->dma);
break;
} }
fail:
} }
#ifdef DEBUG
else
printk ("wd7000_detect: IO 0x%x region already allocated!\n",
iobase);
#endif
} }
if (! present) if (! present)
......
...@@ -1036,5 +1036,5 @@ www home page of USS/Lite: http://www.4front-tech.com/usslite ...@@ -1036,5 +1036,5 @@ www home page of USS/Lite: http://www.4front-tech.com/usslite
European/Finnish mirror: http://personal.eunet.fi/pp/voxware European/Finnish mirror: http://personal.eunet.fi/pp/voxware
www home page of commercial www home page of commercial
UNIX Sound System drivers: http://www.4front-tech.com/uss.html Open Sound System drivers: http://www.4front-tech.com/uss.html
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#ifndef _DEV_TABLE_H_ #ifndef _DEV_TABLE_H_
#define _DEV_TABLE_H_ #define _DEV_TABLE_H_
#include <linux/config.h>
/* /*
* Sound card numbers 27 to 999. (1 to 26 are defined in soundcard.h) * Sound card numbers 27 to 999. (1 to 26 are defined in soundcard.h)
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
#include <linux/stat.h> #include <linux/stat.h>
#include <linux/malloc.h> #include <linux/malloc.h>
#include <linux/binfmts.h> #include <linux/binfmts.h>
#include <paths.h>
#define _PATH_JAVA "/usr/bin/java" #define _PATH_JAVA "/usr/bin/java"
#define _PATH_APPLET "/usr/bin/appletviewer" #define _PATH_APPLET "/usr/bin/appletviewer"
...@@ -93,7 +92,7 @@ static int do_load_applet(struct linux_binprm *bprm,struct pt_regs *regs) ...@@ -93,7 +92,7 @@ static int do_load_applet(struct linux_binprm *bprm,struct pt_regs *regs)
/* /*
* OK, we've set the interpreter name * OK, we've set the interpreter name
* Splice in (1) the interpreter's name for argv[0] (_PATH_BSHELL) * Splice in (1) the interpreter's name for argv[0] (_PATH_SH)
* (2) the name of the appletviewer wrapper for argv[1] (_PATH_APPLET) * (2) the name of the appletviewer wrapper for argv[1] (_PATH_APPLET)
* (3) filename of html file (replace argv[0]) * (3) filename of html file (replace argv[0])
* *
......
...@@ -69,6 +69,7 @@ int buffers_lav[NR_SIZES] = {0,}; /* Load average of buffer usage */ ...@@ -69,6 +69,7 @@ int buffers_lav[NR_SIZES] = {0,}; /* Load average of buffer usage */
int nr_free[NR_SIZES] = {0,}; int nr_free[NR_SIZES] = {0,};
int buffermem = 0; int buffermem = 0;
int nr_buffer_heads = 0; int nr_buffer_heads = 0;
int refilled = 0; /* Set NZ when a buffer freelist is refilled */
extern int *blksize_size[]; extern int *blksize_size[];
/* Here is the parameter block for the bdflush process. If you add or /* Here is the parameter block for the bdflush process. If you add or
...@@ -568,6 +569,7 @@ void refill_freelist(int size) ...@@ -568,6 +569,7 @@ void refill_freelist(int size)
if (nr_free[isize] > 100) if (nr_free[isize] > 100)
return; return;
++refilled;
/* If there are too many dirty buffers, we wake up the update process /* If there are too many dirty buffers, we wake up the update process
now so as to ensure that there are still clean buffers available now so as to ensure that there are still clean buffers available
for user processes to use (and dirty) */ for user processes to use (and dirty) */
...@@ -810,6 +812,7 @@ void set_writetime(struct buffer_head * buf, int flag) ...@@ -810,6 +812,7 @@ void set_writetime(struct buffer_head * buf, int flag)
void refile_buffer(struct buffer_head * buf) void refile_buffer(struct buffer_head * buf)
{ {
int dispose; int dispose;
int isize;
if(buf->b_dev == B_FREE) { if(buf->b_dev == B_FREE) {
printk("Attempt to refile free buffer\n"); printk("Attempt to refile free buffer\n");
...@@ -835,10 +838,21 @@ void refile_buffer(struct buffer_head * buf) ...@@ -835,10 +838,21 @@ void refile_buffer(struct buffer_head * buf)
remove_from_queues(buf); remove_from_queues(buf);
buf->b_list = dispose; buf->b_list = dispose;
insert_into_queues(buf); insert_into_queues(buf);
if(dispose == BUF_DIRTY && nr_buffers_type[BUF_DIRTY] > if (dispose == BUF_DIRTY) {
/* This buffer is dirty, maybe we need to start flushing. */
/* If too high a percentage of the buffers are dirty... */
if (nr_buffers_type[BUF_DIRTY] >
(nr_buffers - nr_buffers_type[BUF_SHARED]) * (nr_buffers - nr_buffers_type[BUF_SHARED]) *
bdf_prm.b_un.nfract/100) bdf_prm.b_un.nfract/100)
wakeup_bdflush(0); wakeup_bdflush(0);
/* If this is a loop device, and
* more than half of the buffers of this size are dirty... */
/* (Prevents no-free-buffers deadlock with loop device.) */
isize = BUFSIZE_INDEX(buf->b_size);
if (MAJOR(buf->b_dev) == LOOP_MAJOR &&
nr_buffers_st[isize][BUF_DIRTY]*2>nr_buffers_size[isize])
wakeup_bdflush(1);
}
} }
} }
...@@ -1383,6 +1397,7 @@ static int grow_buffers(int pri, int size) ...@@ -1383,6 +1397,7 @@ static int grow_buffers(int pri, int size)
} }
insert_point = tmp; insert_point = tmp;
++nr_buffers; ++nr_buffers;
++nr_buffers_size[isize];
if (tmp->b_this_page) if (tmp->b_this_page)
tmp = tmp->b_this_page; tmp = tmp->b_this_page;
else else
...@@ -1886,9 +1901,12 @@ void buffer_init(void) ...@@ -1886,9 +1901,12 @@ void buffer_init(void)
*/ */
struct wait_queue * bdflush_wait = NULL; struct wait_queue * bdflush_wait = NULL;
struct wait_queue * bdflush_done = NULL; struct wait_queue * bdflush_done = NULL;
struct task_struct *bdflush_tsk = 0;
static void wakeup_bdflush(int wait) static void wakeup_bdflush(int wait)
{ {
if (current == bdflush_tsk)
return;
wake_up(&bdflush_wait); wake_up(&bdflush_wait);
if (wait) { if (wait) {
run_task_queue(&tq_disk); run_task_queue(&tq_disk);
...@@ -2018,6 +2036,14 @@ asmlinkage int sys_bdflush(int func, long data) ...@@ -2018,6 +2036,14 @@ asmlinkage int sys_bdflush(int func, long data)
* the syscall above, but now we launch it ourselves internally with * the syscall above, but now we launch it ourselves internally with
* kernel_thread(...) directly after the first thread in init/main.c */ * kernel_thread(...) directly after the first thread in init/main.c */
/* To prevent deadlocks for a loop device:
* 1) Do non-blocking writes to loop (avoids deadlock with running
* out of request blocks).
* 2) But do a blocking write if the only dirty buffers are loop buffers
* (otherwise we go into an infinite busy-loop).
* 3) Quit writing loop blocks if a freelist went low (avoids deadlock
* with running out of free buffers for loop's "real" device).
*/
int bdflush(void * unused) int bdflush(void * unused)
{ {
int i; int i;
...@@ -2025,6 +2051,8 @@ int bdflush(void * unused) ...@@ -2025,6 +2051,8 @@ int bdflush(void * unused)
int nlist; int nlist;
int ncount; int ncount;
struct buffer_head * bh, *next; struct buffer_head * bh, *next;
int major;
int wrta_cmd = WRITEA; /* non-blocking write for LOOP */
/* /*
* We have a bare-bones task_struct, and really should fill * We have a bare-bones task_struct, and really should fill
...@@ -2035,6 +2063,7 @@ int bdflush(void * unused) ...@@ -2035,6 +2063,7 @@ int bdflush(void * unused)
current->session = 1; current->session = 1;
current->pgrp = 1; current->pgrp = 1;
sprintf(current->comm, "kflushd"); sprintf(current->comm, "kflushd");
bdflush_tsk = current;
/* /*
* As a kernel thread we want to tamper with system buffers * As a kernel thread we want to tamper with system buffers
...@@ -2060,6 +2089,7 @@ int bdflush(void * unused) ...@@ -2060,6 +2089,7 @@ int bdflush(void * unused)
#endif #endif
{ {
ndirty = 0; ndirty = 0;
refilled = 0;
repeat: repeat:
bh = lru_list[nlist]; bh = lru_list[nlist];
if(bh) if(bh)
...@@ -2082,11 +2112,21 @@ int bdflush(void * unused) ...@@ -2082,11 +2112,21 @@ int bdflush(void * unused)
if (buffer_locked(bh) || !buffer_dirty(bh)) if (buffer_locked(bh) || !buffer_dirty(bh))
continue; continue;
major = MAJOR(bh->b_dev);
/* Should we write back buffers that are shared or not?? /* Should we write back buffers that are shared or not??
currently dirty buffers are not shared, so it does not matter */ currently dirty buffers are not shared, so it does not matter */
if (refilled && major == LOOP_MAJOR)
continue;
bh->b_count++; bh->b_count++;
ndirty++; ndirty++;
bh->b_flushtime = 0; bh->b_flushtime = 0;
if (major == LOOP_MAJOR) {
ll_rw_block(wrta_cmd,1, &bh);
wrta_cmd = WRITEA;
if (buffer_dirty(bh))
--ndirty;
}
else
ll_rw_block(WRITE, 1, &bh); ll_rw_block(WRITE, 1, &bh);
#ifdef DEBUG #ifdef DEBUG
if(nlist != BUF_DIRTY) ncount++; if(nlist != BUF_DIRTY) ncount++;
...@@ -2098,6 +2138,14 @@ int bdflush(void * unused) ...@@ -2098,6 +2138,14 @@ int bdflush(void * unused)
if (ncount) printk("sys_bdflush: %d dirty buffers not on dirty list\n", ncount); if (ncount) printk("sys_bdflush: %d dirty buffers not on dirty list\n", ncount);
printk("sleeping again.\n"); printk("sleeping again.\n");
#endif #endif
/* If we didn't write anything, but there are still
* dirty buffers, then make the next write to a
* loop device to be a blocking write.
* This lets us block--which we _must_ do! */
if (ndirty == 0 && nr_buffers_type[BUF_DIRTY] > 0) {
wrta_cmd = WRITE;
continue;
}
run_task_queue(&tq_disk); run_task_queue(&tq_disk);
wake_up(&bdflush_done); wake_up(&bdflush_done);
......
...@@ -519,7 +519,7 @@ int ext2_mkdir (struct inode * dir, const char * name, int len, int mode) ...@@ -519,7 +519,7 @@ int ext2_mkdir (struct inode * dir, const char * name, int len, int mode)
inode->i_nlink = 2; inode->i_nlink = 2;
mark_buffer_dirty(dir_block, 1); mark_buffer_dirty(dir_block, 1);
brelse (dir_block); brelse (dir_block);
inode->i_mode = S_IFDIR | (mode & S_IRWXUGO & ~current->fs->umask); inode->i_mode = S_IFDIR | (mode & (S_IRWXUGO|S_ISVTX) & ~current->fs->umask);
if (dir->i_mode & S_ISGID) if (dir->i_mode & S_ISGID)
inode->i_mode |= S_ISGID; inode->i_mode |= S_ISGID;
inode->i_dirt = 1; inode->i_dirt = 1;
......
...@@ -128,21 +128,20 @@ static void locks_delete_lock(struct file_lock **fl, unsigned int wait); ...@@ -128,21 +128,20 @@ static void locks_delete_lock(struct file_lock **fl, unsigned int wait);
static char *lock_get_status(struct file_lock *fl, char *p, int id, char *pfx); static char *lock_get_status(struct file_lock *fl, char *p, int id, char *pfx);
static struct file_lock *file_lock_table = NULL; static struct file_lock *file_lock_table = NULL;
static struct file_lock *unused_file_locks = NULL;
/* Free lock not inserted in any queue */ /*
* Free lock not inserted in any queue
*
* Careful! We can't just "kfree()" it: there may be other processes
* that have yet to remove themselves from the wait queues. Thus the
* internal memory management.
*/
static inline void locks_free_lock(struct file_lock *fl) static inline void locks_free_lock(struct file_lock *fl)
{ {
/* struct file_lock *next = unused_file_locks;
* CAREFUL! We can't free it until everybody waiting for unused_file_locks = fl;
* this block have removed themselves from the wait queue fl->fl_next = next;
*/
if (fl->fl_wait) {
struct wait_queue *head = WAIT_QUEUE_HEAD(&fl->fl_wait);
while (fl->fl_wait != head)
schedule();
}
kfree(fl);
return;
} }
/* Add lock fl to the blocked list pointed to by block. /* Add lock fl to the blocked list pointed to by block.
...@@ -914,26 +913,30 @@ static int posix_lock_file(struct file *filp, struct file_lock *caller, ...@@ -914,26 +913,30 @@ static int posix_lock_file(struct file *filp, struct file_lock *caller,
static struct file_lock *locks_alloc_lock(struct file_lock *fl) static struct file_lock *locks_alloc_lock(struct file_lock *fl)
{ {
struct file_lock *tmp; struct file_lock *retval;
/* Okay, let's make a new file_lock structure... */ retval = unused_file_locks;
if ((tmp = (struct file_lock *)kmalloc(sizeof(struct file_lock), if (retval) {
GFP_ATOMIC)) == NULL) unused_file_locks = retval->fl_next;
return (tmp); goto init_file_lock;
}
tmp->fl_nextlink = NULL; retval = (struct file_lock *)
tmp->fl_prevlink = NULL; kmalloc(sizeof(struct file_lock), GFP_ATOMIC);
tmp->fl_next = NULL; if (retval) {
tmp->fl_block = NULL; retval->fl_wait = NULL;
tmp->fl_flags = fl->fl_flags; init_file_lock:
tmp->fl_owner = fl->fl_owner; retval->fl_next = NULL;
tmp->fl_file = fl->fl_file; retval->fl_nextlink = NULL;
tmp->fl_wait = NULL; retval->fl_prevlink = NULL;
tmp->fl_type = fl->fl_type; retval->fl_block = NULL;
tmp->fl_start = fl->fl_start; retval->fl_owner = fl->fl_owner;
tmp->fl_end = fl->fl_end; retval->fl_file = fl->fl_file;
retval->fl_flags = fl->fl_flags;
return (tmp); retval->fl_type = fl->fl_type;
retval->fl_start = fl->fl_start;
retval->fl_end = fl->fl_end;
}
return retval;
} }
/* Insert file lock fl into an inode's lock list at the position indicated /* Insert file lock fl into an inode's lock list at the position indicated
......
...@@ -585,7 +585,7 @@ static int do_mkdir(const char * pathname, int mode) ...@@ -585,7 +585,7 @@ static int do_mkdir(const char * pathname, int mode)
if (dir->i_sb && dir->i_sb->dq_op) if (dir->i_sb && dir->i_sb->dq_op)
dir->i_sb->dq_op->initialize(dir, -1); dir->i_sb->dq_op->initialize(dir, -1);
down(&dir->i_sem); down(&dir->i_sem);
error = dir->i_op->mkdir(dir, basename, namelen, mode & 0777 & ~current->fs->umask); error = dir->i_op->mkdir(dir, basename, namelen, mode & 01777 & ~current->fs->umask);
up(&dir->i_sem); up(&dir->i_sem);
iput(dir); iput(dir);
return error; return error;
......
...@@ -948,7 +948,7 @@ static void do_mount_root(void) ...@@ -948,7 +948,7 @@ static void do_mount_root(void)
current->fs->root = inode; current->fs->root = inode;
ROOT_DEV = sb->s_dev; ROOT_DEV = sb->s_dev;
printk (KERN_NOTICE "VFS: Mounted root (nfs filesystem).\n"); printk (KERN_NOTICE "VFS: Mounted root (nfs filesystem).\n");
vfsmnt = add_vfsmnt(ROOT_DEV, "rootfs", "/"); vfsmnt = add_vfsmnt(ROOT_DEV, "/dev/root", "/");
if (!vfsmnt) if (!vfsmnt)
panic("VFS: add_vfsmnt failed for NFS root.\n"); panic("VFS: add_vfsmnt failed for NFS root.\n");
vfsmnt->mnt_sb = sb; vfsmnt->mnt_sb = sb;
...@@ -1010,7 +1010,7 @@ static void do_mount_root(void) ...@@ -1010,7 +1010,7 @@ static void do_mount_root(void)
printk ("VFS: Mounted root (%s filesystem)%s.\n", printk ("VFS: Mounted root (%s filesystem)%s.\n",
fs_type->name, fs_type->name,
(sb->s_flags & MS_RDONLY) ? " readonly" : ""); (sb->s_flags & MS_RDONLY) ? " readonly" : "");
vfsmnt = add_vfsmnt(ROOT_DEV, "rootfs", "/"); vfsmnt = add_vfsmnt(ROOT_DEV, "/dev/root", "/");
if (!vfsmnt) if (!vfsmnt)
panic("VFS: add_vfsmnt failed for root fs"); panic("VFS: add_vfsmnt failed for root fs");
vfsmnt->mnt_sb = sb; vfsmnt->mnt_sb = sb;
...@@ -1075,7 +1075,7 @@ int change_root(kdev_t new_root_dev,const char *put_old) ...@@ -1075,7 +1075,7 @@ int change_root(kdev_t new_root_dev,const char *put_old)
} }
iput(old_root); /* sb->s_covered */ iput(old_root); /* sb->s_covered */
remove_vfsmnt(old_root_dev); remove_vfsmnt(old_root_dev);
vfsmnt = add_vfsmnt(old_root_dev,"old_rootfs",put_old); vfsmnt = add_vfsmnt(old_root_dev,"/dev/root.old",put_old);
if (!vfsmnt) printk(KERN_CRIT "Trouble: add_vfsmnt failed\n"); if (!vfsmnt) printk(KERN_CRIT "Trouble: add_vfsmnt failed\n");
else { else {
vfsmnt->mnt_sb = old_root->i_sb; vfsmnt->mnt_sb = old_root->i_sb;
......
...@@ -34,7 +34,7 @@ extern inline void down(struct semaphore * sem) ...@@ -34,7 +34,7 @@ extern inline void down(struct semaphore * sem)
__asm__ __volatile__( __asm__ __volatile__(
"# atomic down operation\n" "# atomic down operation\n"
"1:\n\t" "1:\n\t"
"leal 1b,%%eax\n\t" "movl $1b,%%eax\n\t"
#ifdef __SMP__ #ifdef __SMP__
"lock ; " "lock ; "
#endif #endif
...@@ -55,7 +55,7 @@ extern inline void up(struct semaphore * sem) ...@@ -55,7 +55,7 @@ extern inline void up(struct semaphore * sem)
{ {
__asm__ __volatile__( __asm__ __volatile__(
"# atomic up operation\n\t" "# atomic up operation\n\t"
"leal 1f,%%eax\n\t" "movl $1f,%%eax\n\t"
#ifdef __SMP__ #ifdef __SMP__
"lock ; " "lock ; "
#endif #endif
......
...@@ -280,6 +280,8 @@ struct cdrom_multisession ...@@ -280,6 +280,8 @@ struct cdrom_multisession
/* /*
* For controlling a changer. (Used by ATAPI driver.) * For controlling a changer. (Used by ATAPI driver.)
* This ioctl is depreciated in favor of CDROM_SELECT_DISC from
* ucdrom.h. It will probably be deleted during the 2.1 kernel series.
*/ */
#define CDROMLOADFROMSLOT 0x531a /* LOAD disk from slot*/ #define CDROMLOADFROMSLOT 0x531a /* LOAD disk from slot*/
......
...@@ -50,8 +50,8 @@ extern int max_files, nr_files; ...@@ -50,8 +50,8 @@ extern int max_files, nr_files;
#define READ 0 #define READ 0
#define WRITE 1 #define WRITE 1
#define READA 2 /* read-ahead - don't pause */ #define READA 2 /* read-ahead - don't block if no resources */
#define WRITEA 3 /* "write-ahead" - silly, but somewhat useful */ #define WRITEA 3 /* write-ahead - don't block if no resources */
#ifndef NULL #ifndef NULL
#define NULL ((void *) 0) #define NULL ((void *) 0)
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* I used an extra 4K port-space * I used an extra 4K port-space
*/ */
#define PORT_MASQ_BEGIN 60000 #define PORT_MASQ_BEGIN 61000
#define PORT_MASQ_END (PORT_MASQ_BEGIN+4096) #define PORT_MASQ_END (PORT_MASQ_BEGIN+4096)
#define MASQUERADE_EXPIRE_TCP 15*60*HZ #define MASQUERADE_EXPIRE_TCP 15*60*HZ
......
...@@ -546,7 +546,7 @@ function parser(ifile,menu) { ...@@ -546,7 +546,7 @@ function parser(ifile,menu) {
printf("}\n") >>menu printf("}\n") >>menu
return return
} }
else if ($0 ~ /^#|$MAKE|mainmenu_name/) { else if ($0 ~ /^#|\$MAKE|mainmenu_name/) {
printf("") >>menu printf("") >>menu
} }
else if ($1 == "source") { else if ($1 == "source") {
......
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <sys/fcntl.h>
#include <sys/mman.h>
char *filename, *command, __depname[256] = "\n\t@touch ";
int needsconfig, hasconfig, hasdep;
#define depname (__depname+9)
struct path_struct {
int len;
char buffer[256-sizeof(int)];
} path_array[2] = {
{ 23, "/usr/src/linux/include/" },
{ 0, "" }
};
static void handle_include(int type, char *name, int len)
{
int plen;
struct path_struct *path = path_array+type;
if (len == 14 && !memcmp(name, "linux/config.h", len))
hasconfig = 1;
plen = path->len;
memcpy(path->buffer+plen, name, len);
len += plen;
path->buffer[len] = '\0';
if (access(path->buffer, F_OK))
return;
if (!hasdep) {
hasdep = 1;
printf("%s:", depname);
}
printf(" \\\n %s", path->buffer);
}
static void handle_config(void)
{
needsconfig = 1;
if (!hasconfig)
fprintf(stderr,
"%s needs config but has not included config file\n",
filename);
}
#if defined(__alpha__) || defined(__i386__)
#define LE_MACHINE
#endif
#ifdef LE_MACHINE
#define first_byte(x) current = (unsigned char) x; x >>= 8;
#else
#define first_byte(x) current = x >> 8*(sizeof(unsigned long)-1); x <<= 8;
#endif
#define GETNEXT { \
if (!__buf) { \
__buf = *(unsigned long *) next; \
if (!__buf) \
break; \
} first_byte(__buf); next++; }
#define CASE(c,label) if (current == c) goto label
#define NOTCASE(c,label) if (current != c) goto label
static void state_machine(char *next)
{
for(;;) {
unsigned long __buf = 0;
unsigned char current;
normal:
GETNEXT
__normal:
CASE('/',slash);
CASE('"',string);
CASE('\'',char_const);
CASE('#',preproc);
goto normal;
slash:
GETNEXT
CASE('*',comment);
goto __normal;
string:
GETNEXT
CASE('"',normal);
NOTCASE('\\',string);
GETNEXT
goto string;
char_const:
GETNEXT
CASE('\'',normal);
NOTCASE('\\',char_const);
GETNEXT
goto char_const;
comment:
GETNEXT
__comment:
NOTCASE('*',comment);
GETNEXT
CASE('/',normal);
goto __comment;
preproc:
GETNEXT
CASE('\n',normal);
CASE(' ',preproc);
CASE('\t',preproc);
CASE('i',i_preproc);
GETNEXT
skippreproc:
CASE('\n',normal);
CASE('\\',skippreprocslash);
GETNEXT
goto skippreproc;
skippreprocslash:
GETNEXT;
GETNEXT;
goto skippreproc;
i_preproc:
GETNEXT
CASE('f',if_line);
NOTCASE('n',skippreproc);
GETNEXT
NOTCASE('c',skippreproc);
GETNEXT
NOTCASE('l',skippreproc);
GETNEXT
NOTCASE('u',skippreproc);
GETNEXT
NOTCASE('d',skippreproc);
GETNEXT
NOTCASE('e',skippreproc);
/* "# include" found */
include_line:
GETNEXT
CASE('\n',normal);
CASE('<', std_include_file);
NOTCASE('"', include_line);
/* "local" include file */
{
char *incname = next;
local_include_name:
GETNEXT
CASE('\n',normal);
NOTCASE('"', local_include_name);
handle_include(1, incname, next-incname-1);
goto skippreproc;
}
/* <std> include file */
std_include_file:
{
char *incname = next;
std_include_name:
GETNEXT
CASE('\n',normal);
NOTCASE('>', std_include_name);
handle_include(0, incname, next-incname-1);
goto skippreproc;
}
if_line:
if (needsconfig)
goto skippreproc;
if_start:
if (!memcmp("CONFIG_", next, 7)) {
handle_config();
goto skippreproc;
}
GETNEXT
CASE('\n', normal);
CASE('_', if_middle);
if (current >= 'a' && current <= 'z')
goto if_middle;
if (current < 'A' || current > 'Z')
goto if_start;
if_middle:
GETNEXT
CASE('\n', normal);
CASE('_', if_middle);
if (current >= 'a' && current <= 'z')
goto if_middle;
if (current < 'A' || current > 'Z')
goto if_start;
goto if_middle;
}
}
static void do_depend(void)
{
char *map;
int mapsize;
int pagesizem1 = getpagesize()-1;
int fd = open(filename, O_RDONLY);
struct stat st;
if (fd < 0) {
perror("mkdep: open");
return;
}
fstat(fd, &st);
mapsize = st.st_size + 2*sizeof(unsigned long);
mapsize = (mapsize+pagesizem1) & ~pagesizem1;
map = mmap(NULL, mapsize, PROT_READ, MAP_PRIVATE, fd, 0);
if (-1 == (long)map) {
perror("mkdep: mmap");
close(fd);
return;
}
close(fd);
state_machine(map);
munmap(map, mapsize);
if (hasdep)
puts(command);
}
int main(int argc, char **argv)
{
int len;
char * hpath;
hpath = getenv("HPATH");
if (!hpath)
hpath = "/usr/src/linux/include";
len = strlen(hpath);
memcpy(path_array[0].buffer, hpath, len);
if (len && hpath[len-1] != '/') {
path_array[0].buffer[len] = '/';
len++;
}
path_array[0].buffer[len] = '\0';
path_array[0].len = len;
while (--argc > 0) {
int len;
char *name = *++argv;
filename = name;
len = strlen(name);
memcpy(depname, name, len+1);
command = __depname;
if (len > 2 && name[len-2] == '.') {
switch (name[len-1]) {
case 'c':
case 'S':
depname[len-1] = 'o';
command = "";
}
}
needsconfig = hasconfig = hasdep = 0;
do_depend();
if (hasconfig && !needsconfig)
fprintf(stderr, "%s doesn't need config\n", filename);
}
return 0;
}
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