Commit cc8a3f45 authored by Linus Torvalds's avatar Linus Torvalds

Import 1.1.30

parent 008dda0c
VERSION = 1 VERSION = 1
PATCHLEVEL = 1 PATCHLEVEL = 1
SUBLEVEL = 29 SUBLEVEL = 30
all: Version zImage all: Version zImage
......
...@@ -25,7 +25,7 @@ SYSSIZE = DEF_SYSSIZE ...@@ -25,7 +25,7 @@ SYSSIZE = DEF_SYSSIZE
! buffer cache as in minix (and especially now that the kernel is ! buffer cache as in minix (and especially now that the kernel is
! compressed :-) ! compressed :-)
! !
! The loader has been made as simple as possible, and continuos ! The loader has been made as simple as possible, and continuous
! read errors will result in a unbreakable loop. Reboot by hand. It ! read errors will result in a unbreakable loop. Reboot by hand. It
! loads pretty fast by getting whole tracks at a time whenever possible. ! loads pretty fast by getting whole tracks at a time whenever possible.
...@@ -69,7 +69,7 @@ _main: ...@@ -69,7 +69,7 @@ _main:
jmpi go,INITSEG jmpi go,INITSEG
go: mov ax,cs go: mov ax,cs
mov dx,#0x4000-12 ! 0x4000 is arbitrary value >= length of mov di,#0x4000-12 ! 0x4000 is arbitrary value >= length of
! bootsect + length of setup + room for stack ! bootsect + length of setup + room for stack
! 12 is disk parm size ! 12 is disk parm size
...@@ -82,7 +82,7 @@ go: mov ax,cs ...@@ -82,7 +82,7 @@ go: mov ax,cs
mov ds,ax mov ds,ax
mov es,ax mov es,ax
mov ss,ax ! put stack at INITSEG:0x4000-12. mov ss,ax ! put stack at INITSEG:0x4000-12.
mov sp,dx mov sp,di
/* /*
* Many BIOS's default disk parameter tables will not * Many BIOS's default disk parameter tables will not
* recognize multi-sector reads beyond the maximum sector number * recognize multi-sector reads beyond the maximum sector number
...@@ -92,40 +92,38 @@ go: mov ax,cs ...@@ -92,40 +92,38 @@ go: mov ax,cs
* Since single sector reads are slow and out of the question, * Since single sector reads are slow and out of the question,
* we must take care of this by creating new parameter tables * we must take care of this by creating new parameter tables
* (for the first disk) in RAM. We will set the maximum sector * (for the first disk) in RAM. We will set the maximum sector
* count to 18 - the most we will encounter on an HD 1.44. * count to 36 - the most we will encounter on an ED 2.88.
* *
* High doesn't hurt. Low does. * High doesn't hurt. Low does.
* *
* Segments are as follows: ds=es=ss=cs - INITSEG, * Segments are as follows: ds=es=ss=cs - INITSEG,
* fs = 0, gs = parameter table segment * fs = 0, gs is unused.
*/ */
push #0 push #0
pop fs pop fs
mov bx,#0x78 ! fs:bx is parameter table address mov bx,#0x78 ! fs:bx is parameter table address
push ds
seg fs seg fs
lgs si,(bx) ! gs:si is source lds si,(bx) ! ds:si is source
mov di,dx ! es:di is destination
mov cx,#6 ! copy 12 bytes mov cx,#6 ! copy 12 bytes
cld cld
push di
rep rep
seg gs
movsw movsw
mov di,dx pop di
movb 4(di),*18 ! patch sector count pop ds
movb 4(di),*36 ! patch sector count
seg fs seg fs
mov (bx),di mov (bx),di
seg fs seg fs
mov 2(bx),es mov 2(bx),es
mov ax,cs
mov fs,ax
mov gs,ax
xor ah,ah ! reset FDC xor ah,ah ! reset FDC
xor dl,dl xor dl,dl
int 0x13 int 0x13
...@@ -170,26 +168,31 @@ ok_load_setup: ...@@ -170,26 +168,31 @@ ok_load_setup:
#else #else
! It seems that there is no BIOS call to get the number of sectors. Guess ! It seems that there is no BIOS call to get the number of sectors. Guess
! 18 sectors if sector 18 can be read, 15 if sector 15 can be read. ! 36 sectors if sector 36 can be read, 18 sectors if sector 18 can be read,
! Otherwise guess 9. ! 15 if sector 15 can be read. Otherwise guess 9.
mov si,#disksizes ! table of sizes to try
probe_loop:
lodsb
cbw ! extend to word
seg cs
mov sectors, ax
cmp si,#disksizes+4
jae got_sectors ! if all else fails, try 9
xchg ax, cx ! cx = track and sector
xor dx, dx ! drive 0, head 0 xor dx, dx ! drive 0, head 0
mov cx,#0x0012 ! sector 18, track 0
mov bx,#0x0200+SETUPSECS*0x200 ! address after setup (es = cs) mov bx,#0x0200+SETUPSECS*0x200 ! address after setup (es = cs)
mov ax,#0x0201 ! service 2, 1 sector mov ax,#0x0201 ! service 2, 1 sector
int 0x13 int 0x13
jnc got_sectors jc probe_loop ! try next value
mov cl,#0x0f ! sector 15
mov ax,#0x0201 ! service 2, 1 sector
int 0x13
jnc got_sectors
mov cl,#0x09
#endif #endif
got_sectors: got_sectors:
seg cs
mov sectors,cx ! Restore es
mov ax,#INITSEG mov ax,#INITSEG
mov es,ax mov es,ax
...@@ -216,8 +219,8 @@ got_sectors: ...@@ -216,8 +219,8 @@ got_sectors:
! After that we check which root-device to use. If the device is ! After that we check which root-device to use. If the device is
! defined (!= 0), nothing is done and the given device is used. ! defined (!= 0), nothing is done and the given device is used.
! Otherwise, either /dev/PS0 (2,28) or /dev/at0 (2,8), depending ! Otherwise, one of /dev/fd0H2880 (2,32) or /dev/PS0 (2,28) or /dev/at0 (2,8),
! on the number of sectors that the BIOS reports currently. ! depending on the number of sectors we pretend to know we have.
seg cs seg cs
mov ax,root_dev mov ax,root_dev
...@@ -228,10 +231,13 @@ got_sectors: ...@@ -228,10 +231,13 @@ got_sectors:
mov ax,#0x0208 ! /dev/ps0 - 1.2Mb mov ax,#0x0208 ! /dev/ps0 - 1.2Mb
cmp bx,#15 cmp bx,#15
je root_defined je root_defined
mov ax,#0x021c ! /dev/PS0 - 1.44Mb mov al,#0x1c ! /dev/PS0 - 1.44Mb
cmp bx,#18 cmp bx,#18
je root_defined je root_defined
mov ax,#0x0200 ! /dev/fd0 - autodetect mov al,#0x20 ! /dev/fd0H2880 - 2.88Mb
cmp bx,#36
je root_defined
mov al,#0 ! /dev/fd0 - autodetect
root_defined: root_defined:
seg cs seg cs
mov root_dev,ax mov root_dev,ax
...@@ -362,7 +368,7 @@ print_loop: ...@@ -362,7 +368,7 @@ print_loop:
push cx ! save count left push cx ! save count left
call print_nl ! nl for readability call print_nl ! nl for readability
cmp cl, 5 cmp cl, #5
jae no_reg ! see if register name is needed jae no_reg ! see if register name is needed
mov ax, #0xe05 + 'A - 1 mov ax, #0xe05 + 'A - 1
...@@ -399,15 +405,12 @@ print_hex: ...@@ -399,15 +405,12 @@ print_hex:
mov dx, (bp) ! load word into dx mov dx, (bp) ! load word into dx
print_digit: print_digit:
rol dx, #4 ! rotate so that lowest 4 bits are used rol dx, #4 ! rotate so that lowest 4 bits are used
mov ah, #0xe mov ax, #0xe0f ! ah = request, al = mask for nybble
mov al, dl ! mask off so we have only next nibble and al, dl
and al, #0xf add al, #0x90 ! convert al to ascii hex (four instructions)
add al, #'0 ! convert to 0-based digit daa
cmp al, #'9 ! check for overflow adc al, #0x40
jbe good_digit daa
add al, #'A - '0 - 10
good_digit:
int 0x10 int 0x10
loop print_digit loop print_digit
ret ret
...@@ -429,6 +432,9 @@ kill_motor: ...@@ -429,6 +432,9 @@ kill_motor:
sectors: sectors:
.word 0 .word 0
disksizes:
.byte 36,18,15,9
msg1: msg1:
.byte 13,10 .byte 13,10
.ascii "Loading" .ascii "Loading"
......
...@@ -285,8 +285,8 @@ _tmp_floppy_area: ...@@ -285,8 +285,8 @@ _tmp_floppy_area:
/* /*
* floppy_track_buffer is used to buffer one track of floppy data: it * floppy_track_buffer is used to buffer one track of floppy data: it
* has to be separate from the tmp_floppy area, as otherwise a single- * has to be separate from the tmp_floppy area, as otherwise a single-
* sector read/write can mess it up. It can contain one full track of * sector read/write can mess it up. It can contain one full cylinder (sic) of
* data (18*2*512 bytes). * data (36*2*512 bytes).
*/ */
_floppy_track_buffer: _floppy_track_buffer:
.fill 512*2*36,1,0 .fill 512*2*36,1,0
......
...@@ -21,8 +21,8 @@ ...@@ -21,8 +21,8 @@
/* /*
* Ok, this is an expanded form so that we can use the same * Ok, this is an expanded form so that we can use the same
* request for paging requests when that is implemented. In * request for paging requests when that is implemented. In
* paging, 'bh' is NULL, and 'waiting' is used to wait for * paging, 'bh' is NULL, and the semaphore is used to wait
* read/write completion. * for read/write completion.
*/ */
struct request { struct request {
int dev; /* -1 if no request */ int dev; /* -1 if no request */
...@@ -32,7 +32,7 @@ struct request { ...@@ -32,7 +32,7 @@ struct request {
unsigned long nr_sectors; unsigned long nr_sectors;
unsigned long current_nr_sectors; unsigned long current_nr_sectors;
char * buffer; char * buffer;
struct task_struct * waiting; struct semaphore * sem;
struct buffer_head * bh; struct buffer_head * bh;
struct buffer_head * bhtail; struct buffer_head * bhtail;
struct request * next; struct request * next;
...@@ -271,7 +271,6 @@ static void end_request(int uptodate) ...@@ -271,7 +271,6 @@ static void end_request(int uptodate)
{ {
struct request * req; struct request * req;
struct buffer_head * bh; struct buffer_head * bh;
struct task_struct * p;
req = CURRENT; req = CURRENT;
req->errors = 0; req->errors = 0;
...@@ -302,13 +301,8 @@ static void end_request(int uptodate) ...@@ -302,13 +301,8 @@ static void end_request(int uptodate)
} }
DEVICE_OFF(req->dev); DEVICE_OFF(req->dev);
CURRENT = req->next; CURRENT = req->next;
if ((p = req->waiting) != NULL) { if (req->sem != NULL)
req->waiting = NULL; up(req->sem);
p->swapping = 0;
p->state = TASK_RUNNING;
if (p->counter > current->counter)
need_resched = 1;
}
req->dev = -1; req->dev = -1;
wake_up(&wait_for_request); wake_up(&wait_for_request);
} }
......
...@@ -68,6 +68,10 @@ ...@@ -68,6 +68,10 @@
* minor modifications to allow 2.88 floppies to be run. * minor modifications to allow 2.88 floppies to be run.
*/ */
/* 1994/7/13 -- Paul Vojta -- modified the probing code to allow three or more
* disk types.
*/
#define REALLY_SLOW_IO #define REALLY_SLOW_IO
#define FLOPPY_IRQ 6 #define FLOPPY_IRQ 6
...@@ -165,34 +169,68 @@ static struct floppy_struct floppy_type[] = { ...@@ -165,34 +169,68 @@ static struct floppy_struct floppy_type[] = {
{ 1440, 9,2,80,0,0x23,0x01,0xDF,0x50,NULL }, /* 720kB in 1.2MB drive */ { 1440, 9,2,80,0,0x23,0x01,0xDF,0x50,NULL }, /* 720kB in 1.2MB drive */
{ 2880,18,2,80,0,0x1B,0x00,0xCF,0x6C,NULL }, /* 1.44MB diskette */ { 2880,18,2,80,0,0x1B,0x00,0xCF,0x6C,NULL }, /* 1.44MB diskette */
{ 5760,36,2,80,0,0x1B,0x43,0xAF,0x54,NULL }, /* 2.88MB diskette */ { 5760,36,2,80,0,0x1B,0x43,0xAF,0x54,NULL }, /* 2.88MB diskette */
{ 5760,36,2,80,0,0x1B,0x43,0xAF,0x54,NULL }, /* 2.88MB diskette */
}; };
/* /*
* Auto-detection. Each drive type has a pair of formats which are * Auto-detection. Each drive type has a number of formats which are
* used in succession to try to read the disk. If the FDC cannot lock onto * used in succession to try to read the disk. If the FDC cannot lock onto
* the disk, the next format is tried. This uses the variable 'probing'. * the disk, the next format is tried. This uses the variable 'probing'.
*/ */
static struct floppy_struct floppy_types[] = { #define NUMBER(x) (sizeof(x) / sizeof(*(x)))
{ 720, 9,2,40,0,0x2A,0x02,0xDF,0x50,"360k/PC" }, /* 360kB PC diskettes */
static struct floppy_struct floppy_type_1[] = {
{ 720, 9,2,40,0,0x2A,0x02,0xDF,0x50,"360k/PC" }, /* 360kB PC diskettes */ { 720, 9,2,40,0,0x2A,0x02,0xDF,0x50,"360k/PC" }, /* 360kB PC diskettes */
};
static struct floppy_struct floppy_type_2[] = {
{ 2400,15,2,80,0,0x1B,0x00,0xDF,0x54,"1.2M" }, /* 1.2 MB AT-diskettes */ { 2400,15,2,80,0,0x1B,0x00,0xDF,0x54,"1.2M" }, /* 1.2 MB AT-diskettes */
{ 720, 9,2,40,1,0x23,0x01,0xDF,0x50,"360k/AT" }, /* 360kB in 1.2MB drive */ { 720, 9,2,40,1,0x23,0x01,0xDF,0x50,"360k/AT" }, /* 360kB in 1.2MB drive */
};
static struct floppy_struct floppy_type_3[] = {
{ 1440, 9,2,80,0,0x2A,0x02,0xDF,0x50,"720k" }, /* 3.5" 720kB diskette */ { 1440, 9,2,80,0,0x2A,0x02,0xDF,0x50,"720k" }, /* 3.5" 720kB diskette */
{ 1440, 9,2,80,0,0x2A,0x02,0xDF,0x50,"720k" }, /* 3.5" 720kB diskette */ };
static struct floppy_struct floppy_type_4[] = {
{ 2880,18,2,80,0,0x1B,0x00,0xCF,0x6C,"1.44M" }, /* 1.44MB diskette */
{ 1440, 9,2,80,0,0x2A,0x02,0xDF,0x50,"720k/AT" }, /* 3.5" 720kB diskette */
};
static struct floppy_struct floppy_type_5[] = {
{ 5760,36,2,80,0,0x1B,0x43,0xAF,0x50,"2.88M" }, /* 2.88MB diskette */
{ 2880,18,2,80,0,0x1B,0x00,0xCF,0x6C,"1.44M" }, /* 1.44MB diskette */ { 2880,18,2,80,0,0x1B,0x00,0xCF,0x6C,"1.44M" }, /* 1.44MB diskette */
{ 1440, 9,2,80,0,0x2A,0x02,0xDF,0x50,"720k/AT" }, /* 3.5" 720kB diskette */ { 1440, 9,2,80,0,0x2A,0x02,0xDF,0x50,"720k/AT" }, /* 3.5" 720kB diskette */
{ 5760,36,2,80,0,0x1B,0x43,0xAF,0x54,"2.88M-AMI" }, /* DUMMY */ };
{ 2880,18,2,80,0,0x1B,0x00,0xCF,0x6C,"1.44M-AMI" }, /* Dummy */
{ 5760,36,2,80,0,0x1B,0x43,0xAF,0x54,"2.88M" }, /* 2.88MB diskette */ #define floppy_type_6 floppy_type_5 /* 5 and 6 are the same */
{ 2880,18,2,80,0,0x1B,0x40,0xCF,0x6C,"1.44MX" }, /* 1.44MB diskette */
static struct floppy_struct *floppy_types[] = {
floppy_type_1,
floppy_type_2,
floppy_type_3,
floppy_type_4,
floppy_type_5,
floppy_type_6,
};
static int floppy_num_types[] = {
NUMBER(floppy_type_1),
NUMBER(floppy_type_2),
NUMBER(floppy_type_3),
NUMBER(floppy_type_4),
NUMBER(floppy_type_5),
NUMBER(floppy_type_6),
}; };
/* Auto-detection: Disk type used until the next media change occurs. */ /* Auto-detection: Disk type used until the next media change occurs. */
struct floppy_struct *current_type[4] = { NULL, NULL, NULL, NULL }; struct floppy_struct *current_type[4] = { NULL, NULL, NULL, NULL };
/* This type is tried first. */ /* This type is tried first. */
struct floppy_struct *base_type[4]; struct floppy_struct *base_type[4] = { NULL, NULL, NULL, NULL };
/* This gives the end of the list */
struct floppy_struct *base_type_end[4];
/* /*
* User-provided type information. current_type points to * User-provided type information. current_type points to
...@@ -279,8 +317,8 @@ static unsigned short min_report_error_cnt[4] = {2, 2, 2, 2}; ...@@ -279,8 +317,8 @@ static unsigned short min_report_error_cnt[4] = {2, 2, 2, 2};
* Track buffer and block buffer (in case track buffering doesn't work). * Track buffer and block buffer (in case track buffering doesn't work).
* Because these are written to by the DMA controller, they must * Because these are written to by the DMA controller, they must
* not contain a 64k byte boundary crossing, or data will be * not contain a 64k byte boundary crossing, or data will be
* corrupted/lost. Alignment of these is enforced in boot/head.s. * corrupted/lost. Alignment of these is enforced in boot/head.S.
* Note that you must not change the sizes below without updating head.s. * Note that you must not change the sizes below without updating head.S.
*/ */
extern char tmp_floppy_area[BLOCK_SIZE]; extern char tmp_floppy_area[BLOCK_SIZE];
extern char floppy_track_buffer[512*2*MAX_BUFFER_SECTORS]; extern char floppy_track_buffer[512*2*MAX_BUFFER_SECTORS];
...@@ -395,6 +433,7 @@ static void floppy_off(unsigned int nr) ...@@ -395,6 +433,7 @@ static void floppy_off(unsigned int nr)
void request_done(int uptodate) void request_done(int uptodate)
{ {
timer_active &= ~(1 << FLOPPY_TIMER); timer_active &= ~(1 << FLOPPY_TIMER);
probing = 0;
if (format_status != FORMAT_BUSY) if (format_status != FORMAT_BUSY)
end_request(uptodate); end_request(uptodate);
else { else {
...@@ -563,6 +602,13 @@ static void bad_flp_intr(void) ...@@ -563,6 +602,13 @@ static void bad_flp_intr(void)
{ {
int errors; int errors;
if (probing) {
int device = MINOR(CURRENT_DEVICE) & 3;
++floppy;
if (floppy < base_type_end[device])
return;
floppy = base_type[device];
}
current_track = NO_TRACK; current_track = NO_TRACK;
if (format_status == FORMAT_BUSY) if (format_status == FORMAT_BUSY)
errors = ++format_errors; errors = ++format_errors;
...@@ -1080,21 +1126,20 @@ static void redo_fd_request(void) ...@@ -1080,21 +1126,20 @@ static void redo_fd_request(void)
} }
} }
seek = 0; seek = 0;
probing = 0;
device = MINOR(CURRENT_DEVICE); device = MINOR(CURRENT_DEVICE);
if (device > 3) if (device > 3)
floppy = (device >> 2) + floppy_type; floppy = (device >> 2) + floppy_type;
else { /* Auto-detection */ else { /* Auto-detection */
floppy = current_type[device & 3]; if (!probing) {
if (!floppy) { floppy = current_type[device & 3];
probing = 1;
floppy = base_type[device & 3];
if (!floppy) { if (!floppy) {
request_done(0); probing = 1;
goto repeat; floppy = base_type[device & 3];
if (!floppy) {
request_done(0);
goto repeat;
}
} }
if (CURRENT_ERRORS & 1)
floppy++;
} }
} }
if (format_status != FORMAT_BUSY) { if (format_status != FORMAT_BUSY) {
...@@ -1297,33 +1342,29 @@ outb_p(addr,0x70); \ ...@@ -1297,33 +1342,29 @@ outb_p(addr,0x70); \
inb_p(0x71); \ inb_p(0x71); \
}) })
static struct floppy_struct *find_base(int drive,int code) static void set_base_type(int drive,int code)
{ {
struct floppy_struct *base; struct floppy_struct *base;
if (code > 0 && code < 7) { /* -bb*/ if (code > 0 && code <= NUMBER(floppy_types)) {
base = &floppy_types[(code-1)*2]; base = floppy_types[code-1];
printk("fd%d is %s",drive,base->name); printk("fd%d is %s",drive,base->name);
return base; base_type[drive] = base;
} else if (!code) { base_type_end[drive] = base + floppy_num_types[code-1];
} else if (!code)
printk("fd%d is not installed", drive); printk("fd%d is not installed", drive);
return NULL; else
} printk("fd%d is unknown type %d",drive,code);
printk("fd%d is unknown type %d",drive,code);
return NULL;
} }
static void config_types(void) static void config_types(void)
{ {
printk("Floppy drive(s): "); printk("Floppy drive(s): ");
base_type[0] = find_base(0,(CMOS_READ(0x10) >> 4) & 15); set_base_type(0, (CMOS_READ(0x10) >> 4) & 15);
if ((CMOS_READ(0x10) & 15) == 0) if (CMOS_READ(0x10) & 15) {
base_type[1] = NULL;
else {
printk(", "); printk(", ");
base_type[1] = find_base(1,CMOS_READ(0x10) & 15); set_base_type(1, CMOS_READ(0x10) & 15);
} }
base_type[2] = base_type[3] = NULL;
printk("\n"); printk("\n");
} }
......
...@@ -233,7 +233,7 @@ static void make_request(int major,int rw, struct buffer_head * bh) ...@@ -233,7 +233,7 @@ static void make_request(int major,int rw, struct buffer_head * bh)
req = req->next; req = req->next;
while (req) { while (req) {
if (req->dev == bh->b_dev && if (req->dev == bh->b_dev &&
!req->waiting && !req->sem &&
req->cmd == rw && req->cmd == rw &&
req->sector + req->nr_sectors == sector && req->sector + req->nr_sectors == sector &&
req->nr_sectors < 244) req->nr_sectors < 244)
...@@ -247,7 +247,7 @@ static void make_request(int major,int rw, struct buffer_head * bh) ...@@ -247,7 +247,7 @@ static void make_request(int major,int rw, struct buffer_head * bh)
} }
if (req->dev == bh->b_dev && if (req->dev == bh->b_dev &&
!req->waiting && !req->sem &&
req->cmd == rw && req->cmd == rw &&
req->sector - count == sector && req->sector - count == sector &&
req->nr_sectors < 244) req->nr_sectors < 244)
...@@ -292,7 +292,7 @@ static void make_request(int major,int rw, struct buffer_head * bh) ...@@ -292,7 +292,7 @@ static void make_request(int major,int rw, struct buffer_head * bh)
req->nr_sectors = count; req->nr_sectors = count;
req->current_nr_sectors = count; req->current_nr_sectors = count;
req->buffer = bh->b_data; req->buffer = bh->b_data;
req->waiting = NULL; req->sem = NULL;
req->bh = bh; req->bh = bh;
req->bhtail = bh; req->bhtail = bh;
req->next = NULL; req->next = NULL;
...@@ -303,6 +303,7 @@ void ll_rw_page(int rw, int dev, int page, char * buffer) ...@@ -303,6 +303,7 @@ void ll_rw_page(int rw, int dev, int page, char * buffer)
{ {
struct request * req; struct request * req;
unsigned int major = MAJOR(dev); unsigned int major = MAJOR(dev);
struct semaphore sem = MUTEX_LOCKED;
if (major >= MAX_BLKDEV || !(blk_dev[major].request_fn)) { if (major >= MAX_BLKDEV || !(blk_dev[major].request_fn)) {
printk("Trying to read nonexistent block-device %04x (%d)\n",dev,page*8); printk("Trying to read nonexistent block-device %04x (%d)\n",dev,page*8);
...@@ -324,16 +325,11 @@ void ll_rw_page(int rw, int dev, int page, char * buffer) ...@@ -324,16 +325,11 @@ void ll_rw_page(int rw, int dev, int page, char * buffer)
req->nr_sectors = 8; req->nr_sectors = 8;
req->current_nr_sectors = 8; req->current_nr_sectors = 8;
req->buffer = buffer; req->buffer = buffer;
req->waiting = current; req->sem = &sem;
req->bh = NULL; req->bh = NULL;
req->next = NULL; req->next = NULL;
current->swapping = 1;
current->state = TASK_SWAPPING;
add_request(major+blk_dev,req); add_request(major+blk_dev,req);
/* The I/O may have inadvertently chagned the task state. down(&sem);
Make sure we really wait until the I/O is done */
if (current->swapping) current->state = TASK_SWAPPING;
schedule();
} }
/* This function can be used to request a number of buffers from a block /* This function can be used to request a number of buffers from a block
...@@ -435,6 +431,7 @@ void ll_rw_swap_file(int rw, int dev, unsigned int *b, int nb, char *buf) ...@@ -435,6 +431,7 @@ void ll_rw_swap_file(int rw, int dev, unsigned int *b, int nb, char *buf)
int buffersize; int buffersize;
struct request * req; struct request * req;
unsigned int major = MAJOR(dev); unsigned int major = MAJOR(dev);
struct semaphore sem = MUTEX_LOCKED;
if (major >= MAX_BLKDEV || !(blk_dev[major].request_fn)) { if (major >= MAX_BLKDEV || !(blk_dev[major].request_fn)) {
printk("ll_rw_swap_file: trying to swap nonexistent block-device\n"); printk("ll_rw_swap_file: trying to swap nonexistent block-device\n");
...@@ -463,16 +460,11 @@ void ll_rw_swap_file(int rw, int dev, unsigned int *b, int nb, char *buf) ...@@ -463,16 +460,11 @@ void ll_rw_swap_file(int rw, int dev, unsigned int *b, int nb, char *buf)
req->nr_sectors = buffersize >> 9; req->nr_sectors = buffersize >> 9;
req->current_nr_sectors = buffersize >> 9; req->current_nr_sectors = buffersize >> 9;
req->buffer = buf; req->buffer = buf;
req->waiting = current; req->sem = &sem;
req->bh = NULL; req->bh = NULL;
req->next = NULL; req->next = NULL;
current->swapping = 1;
current->state = TASK_UNINTERRUPTIBLE;
add_request(major+blk_dev,req); add_request(major+blk_dev,req);
/* The I/O may have inadvertently chagned the task state. down(&sem);
Make sure we really wait until the I/O is done */
if (current->swapping) current->state = TASK_UNINTERRUPTIBLE;
schedule();
} }
} }
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
include CONFIG include CONFIG
include MODULES include MODULES
NETDRV_OBJS := net.a(Space.o) net.a(auto_irq.o) net.a(net_init.o) net.a(loopback.o) NETDRV_OBJS := Space.o auto_irq.o net_init.o loopback.o
CFLAGS := $(CFLAGS) -I../../net/inet CFLAGS := $(CFLAGS) -I../../net/inet
CPP := $(CPP) -I../../net/inet CPP := $(CPP) -I../../net/inet
...@@ -25,28 +25,28 @@ NETDRV_OBJS := $(NETDRV_OBJS) net.a(sk_g16.o) ...@@ -25,28 +25,28 @@ NETDRV_OBJS := $(NETDRV_OBJS) net.a(sk_g16.o)
endif endif
ifdef CONFIG_WD80x3 ifdef CONFIG_WD80x3
NETDRV_OBJS := $(NETDRV_OBJS) net.a(wd.o) NETDRV_OBJS := $(NETDRV_OBJS) wd.o
CONFIG_8390 = CONFIG_8390 CONFIG_8390 = CONFIG_8390
wd.o: wd.c CONFIG wd.o: wd.c CONFIG
$(CC) $(CPPFLAGS) $(CFLAGS) $(WD_OPTS) -c $< $(CC) $(CPPFLAGS) $(CFLAGS) $(WD_OPTS) -c $<
endif endif
ifdef CONFIG_EL2 ifdef CONFIG_EL2
NETDRV_OBJS := $(NETDRV_OBJS) net.a(3c503.o) NETDRV_OBJS := $(NETDRV_OBJS) 3c503.o
CONFIG_8390 = CONFIG_8390 CONFIG_8390 = CONFIG_8390
3c503.o: 3c503.c CONFIG 3c503.o: 3c503.c CONFIG
$(CC) $(CPPFLAGS) $(CFLAGS) $(EL2_OPTS) -c $< $(CC) $(CPPFLAGS) $(CFLAGS) $(EL2_OPTS) -c $<
endif endif
ifdef CONFIG_NE2000 ifdef CONFIG_NE2000
NETDRV_OBJS := $(NETDRV_OBJS) net.a(ne.o) NETDRV_OBJS := $(NETDRV_OBJS) ne.o
CONFIG_8390 = CONFIG_8390 CONFIG_8390 = CONFIG_8390
ne.o: ne.c CONFIG ne.o: ne.c CONFIG
$(CC) $(CPPFLAGS) $(CFLAGS) $(NE_OPTS) -c $< $(CC) $(CPPFLAGS) $(CFLAGS) $(NE_OPTS) -c $<
endif endif
ifdef CONFIG_HPLAN ifdef CONFIG_HPLAN
NETDRV_OBJS := $(NETDRV_OBJS) net.a(hp.o) NETDRV_OBJS := $(NETDRV_OBJS) hp.o
CONFIG_8390 = CONFIG_8390 CONFIG_8390 = CONFIG_8390
hp.o: hp.c CONFIG hp.o: hp.c CONFIG
$(CC) $(CPPFLAGS) $(CFLAGS) $(HP_OPTS) -c $< $(CC) $(CPPFLAGS) $(CFLAGS) $(HP_OPTS) -c $<
...@@ -58,47 +58,47 @@ CONFIG_8390 = CONFIG_8390 ...@@ -58,47 +58,47 @@ CONFIG_8390 = CONFIG_8390
endif endif
ifdef CONFIG_ULTRA ifdef CONFIG_ULTRA
NETDRV_OBJS := $(NETDRV_OBJS) net.a(smc-ultra.o) NETDRV_OBJS := $(NETDRV_OBJS) smc-ultra.o
CONFIG_8390 = CONFIG_8390 CONFIG_8390 = CONFIG_8390
endif endif
ifdef CONFIG_E2100 ifdef CONFIG_E2100
NETDRV_OBJS := $(NETDRV_OBJS) net.a(e2100.o) NETDRV_OBJS := $(NETDRV_OBJS) e2100.o
CONFIG_8390 = CONFIG_8390 CONFIG_8390 = CONFIG_8390
endif endif
ifdef CONFIG_PLIP ifdef CONFIG_PLIP
NETDRV_OBJS := $(NETDRV_OBJS) net.a(plip.o) NETDRV_OBJS := $(NETDRV_OBJS) plip.o
plip.o: plip.c CONFIG plip.o: plip.c CONFIG
$(CC) $(CPPFLAGS) $(CFLAGS) $(PLIP_OPTS) -c $< $(CC) $(CPPFLAGS) $(CFLAGS) $(PLIP_OPTS) -c $<
endif endif
ifdef CONFIG_PPP ifdef CONFIG_PPP
NETDRV_OBJS := $(NETDRV_OBJS) net.a(ppp.o) net.a(slhc.o) NETDRV_OBJS := $(NETDRV_OBJS) ppp.o slhc.o
endif endif
ifdef CONFIG_SLIP ifdef CONFIG_SLIP
NETDRV_OBJS := $(NETDRV_OBJS) net.a(slip.o) net.a(slhc.o) NETDRV_OBJS := $(NETDRV_OBJS) slip.o slhc.o
slip.o: slip.c CONFIG slip.o: slip.c CONFIG
$(CC) $(CPPFLAGS) $(CFLAGS) -c $< $(CC) $(CPPFLAGS) $(CFLAGS) -c $<
endif endif
ifdef CONFIG_DE650 ifdef CONFIG_DE650
NETDRV_OBJS := $(NETDRV_OBJS) net.a(de650.o) NETDRV_OBJS := $(NETDRV_OBJS) de650.o
CONFIG_8390 = CONFIG_8390 CONFIG_8390 = CONFIG_8390
endif endif
ifdef CONFIG_3C589 ifdef CONFIG_3C589
NETDRV_OBJS := $(NETDRV_OBJS) net.a(3c589.o) NETDRV_OBJS := $(NETDRV_OBJS) 3c589.o
endif endif
ifdef CONFIG_DUMMY ifdef CONFIG_DUMMY
NETDRV_OBJS := $(NETDRV_OBJS) net.a(dummy.o) NETDRV_OBJS := $(NETDRV_OBJS) dummy.o
dummy.o: dummy.c CONFIG dummy.o: dummy.c CONFIG
$(CC) $(CPPFLAGS) $(CFLAGS) -c $< $(CC) $(CPPFLAGS) $(CFLAGS) -c $<
endif endif
ifdef CONFIG_DE600 ifdef CONFIG_DE600
NETDRV_OBJS := $(NETDRV_OBJS) net.a(de600.o) NETDRV_OBJS := $(NETDRV_OBJS) de600.o
endif endif
de600.o: de600.c CONFIG de600.o: de600.c CONFIG
$(CC) $(CPPFLAGS) $(CFLAGS) $(DE600_OPTS) -c $< $(CC) $(CPPFLAGS) $(CFLAGS) $(DE600_OPTS) -c $<
...@@ -110,48 +110,48 @@ de620.o: de620.c CONFIG ...@@ -110,48 +110,48 @@ de620.o: de620.c CONFIG
$(CC) $(CPPFLAGS) $(CFLAGS) $(DE620_OPTS) -c $< $(CC) $(CPPFLAGS) $(CFLAGS) $(DE620_OPTS) -c $<
ifdef CONFIG_AT1500 ifdef CONFIG_AT1500
NETDRV_OBJS := $(NETDRV_OBJS) net.a(lance.o) NETDRV_OBJS := $(NETDRV_OBJS) lance.o
endif endif
ifdef CONFIG_LANCE ifdef CONFIG_LANCE
NETDRV_OBJS := $(NETDRV_OBJS) net.a(lance.o) NETDRV_OBJS := $(NETDRV_OBJS) lance.o
endif endif
ifdef CONFIG_AT1700 ifdef CONFIG_AT1700
NETDRV_OBJS := $(NETDRV_OBJS) net.a(at1700.o) NETDRV_OBJS := $(NETDRV_OBJS) at1700.o
endif endif
ifdef CONFIG_EL1 ifdef CONFIG_EL1
NETDRV_OBJS := $(NETDRV_OBJS) net.a(3c501.o) NETDRV_OBJS := $(NETDRV_OBJS) 3c501.o
endif endif
ifdef CONFIG_EL16 ifdef CONFIG_EL16
NETDRV_OBJS := $(NETDRV_OBJS) net.a(3c507.o) NETDRV_OBJS := $(NETDRV_OBJS) 3c507.o
endif endif
ifdef CONFIG_EL3 ifdef CONFIG_EL3
NETDRV_OBJS := $(NETDRV_OBJS) net.a(3c509.o) NETDRV_OBJS := $(NETDRV_OBJS) 3c509.o
endif endif
ifdef CONFIG_EEXPRESS ifdef CONFIG_EEXPRESS
NETDRV_OBJS := $(NETDRV_OBJS) net.a(eexpress.o) NETDRV_OBJS := $(NETDRV_OBJS) eexpress.o
endif endif
ifdef CONFIG_ZNET ifdef CONFIG_ZNET
NETDRV_OBJS := $(NETDRV_OBJS) net.a(znet.o) NETDRV_OBJS := $(NETDRV_OBJS) znet.o
endif endif
ifdef CONFIG_DEPCA ifdef CONFIG_DEPCA
NETDRV_OBJS := $(NETDRV_OBJS) net.a(depca.o) NETDRV_OBJS := $(NETDRV_OBJS) depca.o
depca.o: depca.c CONFIG depca.o: depca.c CONFIG
$(CC) $(CPPFLAGS) $(CFLAGS) $(DEPCA_OPTS) -c $< $(CC) $(CPPFLAGS) $(CFLAGS) $(DEPCA_OPTS) -c $<
endif endif
ifdef CONFIG_ATP ifdef CONFIG_ATP
NETDRV_OBJS := $(NETDRV_OBJS) net.a(atp.o) NETDRV_OBJS := $(NETDRV_OBJS) atp.o
endif endif
ifdef CONFIG_NI52 ifdef CONFIG_NI52
NETDRV_OBJS := $(NETDRV_OBJS) net.a(ni52.o) NETDRV_OBJS := $(NETDRV_OBJS) ni52.o
endif endif
ifdef CONFIG_NI65 ifdef CONFIG_NI65
NETDRV_OBJS := $(NETDRV_OBJS) net.a(ni65.o) NETDRV_OBJS := $(NETDRV_OBJS) ni65.o
endif endif
ifdef CONFIG_ELPLUS ifdef CONFIG_ELPLUS
NETDRV_OBJS := $(NETDRV_OBJS) net.a(3c505.o) NETDRV_OBJS := $(NETDRV_OBJS) 3c505.o
endif endif
ifdef CONFIG_AC3200 ifdef CONFIG_AC3200
NETDRV_OBJS := $(NETDRV_OBJS) net.a(ac3200.o) NETDRV_OBJS := $(NETDRV_OBJS) ac3200.o
CONFIG_8390 = CONFIG_8390 CONFIG_8390 = CONFIG_8390
endif endif
ifdef CONFIG_APRICOT ifdef CONFIG_APRICOT
...@@ -159,17 +159,19 @@ NETDRV_OBJS := $(NETDRV_OBJS) net.a(apricot.o) ...@@ -159,17 +159,19 @@ NETDRV_OBJS := $(NETDRV_OBJS) net.a(apricot.o)
endif endif
ifdef CONFIG_8390 ifdef CONFIG_8390
NETDRV_OBJS := $(NETDRV_OBJS) net.a(8390.o) NETDRV_OBJS := $(NETDRV_OBJS) 8390.o
endif endif
ifdef CONFIG_PI ifdef CONFIG_PI
NETDRV_OBJS := $(NETDRV_OBJS) net.a(pi2.o) NETDRV_OBJS := $(NETDRV_OBJS) pi2.o
CONFIG_PI = CONFIG_PI CONFIG_PI = CONFIG_PI
pi2.o: pi2.c CONFIG pi2.o: pi2.c CONFIG
$(CC) $(CPPFLAGS) $(CFLAGS) $(PI_OPTS) -c $< $(CC) $(CPPFLAGS) $(CFLAGS) $(PI_OPTS) -c $<
endif endif
net.a: $(NETDRV_OBJS) net.a: $(NETDRV_OBJS)
rm -f net.a
ar rc net.a $(NETDRV_OBJS)
ranlib net.a ranlib net.a
clean: clean:
......
...@@ -334,6 +334,13 @@ static void scan_scsis (struct Scsi_Host * shpnt) ...@@ -334,6 +334,13 @@ static void scan_scsis (struct Scsi_Host * shpnt)
if (!the_result) if (!the_result)
{ {
/* It would seem some TOSHIBA CD-ROM gets things wrong */
if (!strncmp(scsi_result+8,"TOSHIBA",7) &&
!strncmp(scsi_result+16,"CD-ROM",6) &&
scsi_result[0] == TYPE_DISK) {
scsi_result[0] = TYPE_ROM;
scsi_result[1] |= 0x80; /* removable */
}
SDpnt->removable = (0x80 & SDpnt->removable = (0x80 &
scsi_result[1]) >> 7; scsi_result[1]) >> 7;
SDpnt->lockable = SDpnt->removable; SDpnt->lockable = SDpnt->removable;
...@@ -617,14 +624,14 @@ Scsi_Cmnd * request_queueable (struct request * req, Scsi_Device * device) ...@@ -617,14 +624,14 @@ Scsi_Cmnd * request_queueable (struct request * req, Scsi_Device * device)
SCpnt->request.nr_sectors -= req->nr_sectors; SCpnt->request.nr_sectors -= req->nr_sectors;
req->current_nr_sectors = bh->b_size >> 9; req->current_nr_sectors = bh->b_size >> 9;
req->buffer = bh->b_data; req->buffer = bh->b_data;
SCpnt->request.waiting = NULL; /* Wait until whole thing done */ SCpnt->request.sem = NULL; /* Wait until whole thing done */
} else { } else {
req->dev = -1; req->dev = -1;
wake_up(&wait_for_request); wake_up(&wait_for_request);
}; };
} else { } else {
SCpnt->request.dev = 0xffff; /* Busy, but no request */ SCpnt->request.dev = 0xffff; /* Busy, but no request */
SCpnt->request.waiting = NULL; /* And no one is waiting for the device either */ SCpnt->request.sem = NULL; /* And no one is waiting for the device either */
}; };
SCpnt->use_sg = 0; /* Reset the scatter-gather flag */ SCpnt->use_sg = 0; /* Reset the scatter-gather flag */
...@@ -716,7 +723,7 @@ Scsi_Cmnd * allocate_device (struct request ** reqp, Scsi_Device * device, ...@@ -716,7 +723,7 @@ Scsi_Cmnd * allocate_device (struct request ** reqp, Scsi_Device * device,
SCpnt->request.nr_sectors -= req->nr_sectors; SCpnt->request.nr_sectors -= req->nr_sectors;
req->current_nr_sectors = bh->b_size >> 9; req->current_nr_sectors = bh->b_size >> 9;
req->buffer = bh->b_data; req->buffer = bh->b_data;
SCpnt->request.waiting = NULL; /* Wait until whole thing done */ SCpnt->request.sem = NULL; /* Wait until whole thing done */
} }
else else
{ {
...@@ -726,7 +733,7 @@ Scsi_Cmnd * allocate_device (struct request ** reqp, Scsi_Device * device, ...@@ -726,7 +733,7 @@ Scsi_Cmnd * allocate_device (struct request ** reqp, Scsi_Device * device,
}; };
} else { } else {
SCpnt->request.dev = 0xffff; /* Busy */ SCpnt->request.dev = 0xffff; /* Busy */
SCpnt->request.waiting = NULL; /* And no one is waiting for this to complete */ SCpnt->request.sem = NULL; /* And no one is waiting for this to complete */
}; };
sti(); sti();
break; break;
...@@ -1914,7 +1921,7 @@ scsi_dump_status(void) ...@@ -1914,7 +1921,7 @@ scsi_dump_status(void)
for(SCpnt=shpnt->host_queue; SCpnt; SCpnt = SCpnt->next) for(SCpnt=shpnt->host_queue; SCpnt; SCpnt = SCpnt->next)
{ {
/* (0) 0:0:0 (802 123434 8 8 0) (3 3 2) (%d %d %d) %d %x */ /* (0) 0:0:0 (802 123434 8 8 0) (3 3 2) (%d %d %d) %d %x */
printk("(%d) %d:%d:%d (%4.4x %d %d %d %d) (%d %d %x) (%d %d %d) %x %x %d %x\n", printk("(%d) %d:%d:%d (%4.4x %d %d %d %d) (%d %d %x) (%d %d %d) %x %x %x\n",
i, SCpnt->host->host_no, i, SCpnt->host->host_no,
SCpnt->target, SCpnt->target,
SCpnt->lun, SCpnt->lun,
...@@ -1931,8 +1938,6 @@ scsi_dump_status(void) ...@@ -1931,8 +1938,6 @@ scsi_dump_status(void)
SCpnt->internal_timeout, SCpnt->internal_timeout,
SCpnt->cmnd[0], SCpnt->cmnd[0],
SCpnt->sense_buffer[2], SCpnt->sense_buffer[2],
(SCpnt->request.waiting ?
SCpnt->request.waiting->pid : 0),
SCpnt->result); SCpnt->result);
}; };
printk("wait_for_request = %x\n", wait_for_request); printk("wait_for_request = %x\n", wait_for_request);
...@@ -1945,14 +1950,12 @@ scsi_dump_status(void) ...@@ -1945,14 +1950,12 @@ scsi_dump_status(void)
printk("%d: ", i); printk("%d: ", i);
req = blk_dev[i].current_request; req = blk_dev[i].current_request;
while(req) { while(req) {
printk("(%x %d %d %d %d %d) ", printk("(%x %d %d %d %d) ",
req->dev, req->dev,
req->cmd, req->cmd,
req->sector, req->sector,
req->nr_sectors, req->nr_sectors,
req->current_nr_sectors, req->current_nr_sectors);
(req->waiting ?
req->waiting->pid : 0));
req = req->next; req = req->next;
} }
printk("\n"); printk("\n");
......
...@@ -522,7 +522,6 @@ static void end_scsi_request(Scsi_Cmnd * SCpnt, int uptodate, int sectors) ...@@ -522,7 +522,6 @@ static void end_scsi_request(Scsi_Cmnd * SCpnt, int uptodate, int sectors)
{ {
struct request * req; struct request * req;
struct buffer_head * bh; struct buffer_head * bh;
struct task_struct * p;
req = &SCpnt->request; req = &SCpnt->request;
req->errors = 0; req->errors = 0;
...@@ -554,12 +553,8 @@ static void end_scsi_request(Scsi_Cmnd * SCpnt, int uptodate, int sectors) ...@@ -554,12 +553,8 @@ static void end_scsi_request(Scsi_Cmnd * SCpnt, int uptodate, int sectors)
return; return;
}; };
DEVICE_OFF(req->dev); DEVICE_OFF(req->dev);
if ((p = req->waiting) != NULL) { if (req->sem != NULL) {
req->waiting = NULL; up(req->sem);
p->swapping = 0;
p->state = TASK_RUNNING;
if (p->counter > current->counter)
need_resched = 1;
} }
req->dev = -1; req->dev = -1;
wake_up(&SCpnt->device->device_wait); wake_up(&SCpnt->device->device_wait);
......
...@@ -73,16 +73,12 @@ static int ioctl_probe(struct Scsi_Host * host, void *buffer) ...@@ -73,16 +73,12 @@ static int ioctl_probe(struct Scsi_Host * host, void *buffer)
static void scsi_ioctl_done (Scsi_Cmnd * SCpnt) static void scsi_ioctl_done (Scsi_Cmnd * SCpnt)
{ {
struct request * req; struct request * req;
struct task_struct * p;
req = &SCpnt->request; req = &SCpnt->request;
req->dev = 0xfffe; /* Busy, but indicate request done */ req->dev = 0xfffe; /* Busy, but indicate request done */
if ((p = req->waiting) != NULL) { if (req->sem != NULL) {
req->waiting = NULL; up(req->sem);
p->state = TASK_RUNNING;
if (p->counter > current->counter)
need_resched = 1;
} }
} }
...@@ -97,8 +93,10 @@ static int ioctl_internal_command(Scsi_Device *dev, char * cmd) ...@@ -97,8 +93,10 @@ static int ioctl_internal_command(Scsi_Device *dev, char * cmd)
MAX_RETRIES); MAX_RETRIES);
if (SCpnt->request.dev != 0xfffe){ if (SCpnt->request.dev != 0xfffe){
SCpnt->request.waiting = current; struct semaphore sem = MUTEX_LOCKED;
current->state = TASK_UNINTERRUPTIBLE; SCpnt->request.sem = &sem;
down(&sem);
/* Hmm.. Have to ask about this one */
while (SCpnt->request.dev != 0xfffe) schedule(); while (SCpnt->request.dev != 0xfffe) schedule();
}; };
...@@ -181,8 +179,10 @@ static int ioctl_command(Scsi_Device *dev, void *buffer) ...@@ -181,8 +179,10 @@ static int ioctl_command(Scsi_Device *dev, void *buffer)
MAX_RETRIES); MAX_RETRIES);
if (SCpnt->request.dev != 0xfffe){ if (SCpnt->request.dev != 0xfffe){
SCpnt->request.waiting = current; struct semaphore sem = MUTEX_LOCKED;
current->state = TASK_UNINTERRUPTIBLE; SCpnt->request.sem = &sem;
down(&sem);
/* Hmm.. Have to ask about this one */
while (SCpnt->request.dev != 0xfffe) schedule(); while (SCpnt->request.dev != 0xfffe) schedule();
}; };
......
...@@ -775,16 +775,12 @@ static int check_scsidisk_media_change(dev_t full_dev){ ...@@ -775,16 +775,12 @@ static int check_scsidisk_media_change(dev_t full_dev){
static void sd_init_done (Scsi_Cmnd * SCpnt) static void sd_init_done (Scsi_Cmnd * SCpnt)
{ {
struct request * req; struct request * req;
struct task_struct * p;
req = &SCpnt->request; req = &SCpnt->request;
req->dev = 0xfffe; /* Busy, but indicate request done */ req->dev = 0xfffe; /* Busy, but indicate request done */
if ((p = req->waiting) != NULL) { if (req->sem != NULL) {
req->waiting = NULL; up(req->sem);
p->state = TASK_RUNNING;
if (p->counter > current->counter)
need_resched = 1;
} }
} }
...@@ -884,8 +880,10 @@ static int sd_init_onedisk(int i) ...@@ -884,8 +880,10 @@ static int sd_init_onedisk(int i)
while(SCpnt->request.dev != 0xfffe); while(SCpnt->request.dev != 0xfffe);
else else
if (SCpnt->request.dev != 0xfffe){ if (SCpnt->request.dev != 0xfffe){
SCpnt->request.waiting = current; struct semaphore sem = MUTEX_LOCKED;
current->state = TASK_UNINTERRUPTIBLE; SCpnt->request.sem = &sem;
down(&sem);
/* Hmm.. Have to ask about this one.. */
while (SCpnt->request.dev != 0xfffe) schedule(); while (SCpnt->request.dev != 0xfffe) schedule();
}; };
......
...@@ -641,11 +641,8 @@ static void sr_init_done (Scsi_Cmnd * SCpnt) ...@@ -641,11 +641,8 @@ static void sr_init_done (Scsi_Cmnd * SCpnt)
req = &SCpnt->request; req = &SCpnt->request;
req->dev = 0xfffe; /* Busy, but indicate request done */ req->dev = 0xfffe; /* Busy, but indicate request done */
if ((p = req->waiting) != NULL) { if (req->sem != NULL) {
req->waiting = NULL; up(req->sem);
p->state = TASK_RUNNING;
if (p->counter > current->counter)
need_resched = 1;
} }
} }
...@@ -675,8 +672,10 @@ static void get_sectorsize(int i){ ...@@ -675,8 +672,10 @@ static void get_sectorsize(int i){
while(SCpnt->request.dev != 0xfffe); while(SCpnt->request.dev != 0xfffe);
else else
if (SCpnt->request.dev != 0xfffe){ if (SCpnt->request.dev != 0xfffe){
SCpnt->request.waiting = current; struct semaphore sem = MUTEX_LOCKED;
current->state = TASK_UNINTERRUPTIBLE; SCpnt->request.sem = &sem;
down(&sem);
/* Hmm.. Have to ask about this */
while (SCpnt->request.dev != 0xfffe) schedule(); while (SCpnt->request.dev != 0xfffe) schedule();
}; };
......
...@@ -26,11 +26,8 @@ static void sr_ioctl_done(Scsi_Cmnd * SCpnt) ...@@ -26,11 +26,8 @@ static void sr_ioctl_done(Scsi_Cmnd * SCpnt)
req = &SCpnt->request; req = &SCpnt->request;
req->dev = 0xfffe; /* Busy, but indicate request done */ req->dev = 0xfffe; /* Busy, but indicate request done */
if ((p = req->waiting) != NULL) { if (req->sem != NULL) {
req->waiting = NULL; up(&req->sem);
p->state = TASK_RUNNING;
if (p->counter > current->counter)
need_resched = 1;
} }
} }
...@@ -50,8 +47,10 @@ static int do_ioctl(int target, unsigned char * sr_cmd, void * buffer, unsigned ...@@ -50,8 +47,10 @@ static int do_ioctl(int target, unsigned char * sr_cmd, void * buffer, unsigned
if (SCpnt->request.dev != 0xfffe){ if (SCpnt->request.dev != 0xfffe){
SCpnt->request.waiting = current; struct semaphore sem = MUTEX_LOCKED;
current->state = TASK_UNINTERRUPTIBLE; SCpnt->request.sem = &sem;
down(&sem);
/* Hmm.. Have to ask about this */
while (SCpnt->request.dev != 0xfffe) schedule(); while (SCpnt->request.dev != 0xfffe) schedule();
}; };
......
...@@ -70,7 +70,7 @@ static struct proc_dir_entry base_dir[] = { ...@@ -70,7 +70,7 @@ static struct proc_dir_entry base_dir[] = {
int proc_match(int len,const char * name,struct proc_dir_entry * de) int proc_match(int len,const char * name,struct proc_dir_entry * de)
{ {
register int same __asm__("ax"); register int same;
if (!de || !de->low_ino) if (!de || !de->low_ino)
return 0; return 0;
...@@ -79,7 +79,8 @@ int proc_match(int len,const char * name,struct proc_dir_entry * de) ...@@ -79,7 +79,8 @@ int proc_match(int len,const char * name,struct proc_dir_entry * de)
return 1; return 1;
if (de->namelen != len) if (de->namelen != len)
return 0; return 0;
__asm__("cld\n\t" __asm__ __volatile__(
"cld\n\t"
"repe ; cmpsb\n\t" "repe ; cmpsb\n\t"
"setz %%al" "setz %%al"
:"=a" (same) :"=a" (same)
......
...@@ -177,6 +177,7 @@ struct inode { ...@@ -177,6 +177,7 @@ struct inode {
time_t i_ctime; time_t i_ctime;
unsigned long i_blksize; unsigned long i_blksize;
unsigned long i_blocks; unsigned long i_blocks;
unsigned long i_version;
struct semaphore i_sem; struct semaphore i_sem;
struct inode_operations * i_op; struct inode_operations * i_op;
struct super_block * i_sb; struct super_block * i_sb;
......
...@@ -264,7 +264,6 @@ struct task_struct { ...@@ -264,7 +264,6 @@ struct task_struct {
unsigned long personality; unsigned long personality;
int dumpable:1; int dumpable:1;
int did_exec:1; int did_exec:1;
volatile int swapping:1;
int pid,pgrp,session,leader; int pid,pgrp,session,leader;
int groups[NGROUPS]; int groups[NGROUPS];
/* /*
...@@ -332,7 +331,7 @@ struct task_struct { ...@@ -332,7 +331,7 @@ struct task_struct {
/* schedlink */ &init_task,&init_task, \ /* schedlink */ &init_task,&init_task, \
/* signals */ {{ 0, },}, \ /* signals */ {{ 0, },}, \
/* stack */ 0,(unsigned long) &init_kernel_stack, \ /* stack */ 0,(unsigned long) &init_kernel_stack, \
/* ec,brk... */ 0,0,0,0,0,0, \ /* ec,brk... */ 0,0,0,0,0, \
/* pid etc.. */ 0,0,0,0, \ /* pid etc.. */ 0,0,0,0, \
/* suppl grps*/ {NOGROUP,}, \ /* suppl grps*/ {NOGROUP,}, \
/* proc links*/ &init_task,&init_task,NULL,NULL,NULL,NULL, \ /* proc links*/ &init_task,&init_task,NULL,NULL,NULL,NULL, \
......
...@@ -25,7 +25,8 @@ extern "C" { ...@@ -25,7 +25,8 @@ extern "C" {
extern inline char * strcpy(char * dest,const char *src) extern inline char * strcpy(char * dest,const char *src)
{ {
__asm__("cld\n" __asm__ __volatile__(
"cld\n"
"1:\tlodsb\n\t" "1:\tlodsb\n\t"
"stosb\n\t" "stosb\n\t"
"testb %%al,%%al\n\t" "testb %%al,%%al\n\t"
...@@ -37,7 +38,8 @@ return dest; ...@@ -37,7 +38,8 @@ return dest;
extern inline char * strncpy(char * dest,const char *src,size_t count) extern inline char * strncpy(char * dest,const char *src,size_t count)
{ {
__asm__("cld\n" __asm__ __volatile__(
"cld\n"
"1:\tdecl %2\n\t" "1:\tdecl %2\n\t"
"js 2f\n\t" "js 2f\n\t"
"lodsb\n\t" "lodsb\n\t"
...@@ -54,7 +56,8 @@ return dest; ...@@ -54,7 +56,8 @@ return dest;
extern inline char * strcat(char * dest,const char * src) extern inline char * strcat(char * dest,const char * src)
{ {
__asm__("cld\n\t" __asm__ __volatile__(
"cld\n\t"
"repne\n\t" "repne\n\t"
"scasb\n\t" "scasb\n\t"
"decl %1\n" "decl %1\n"
...@@ -69,7 +72,8 @@ return dest; ...@@ -69,7 +72,8 @@ return dest;
extern inline char * strncat(char * dest,const char * src,size_t count) extern inline char * strncat(char * dest,const char * src,size_t count)
{ {
__asm__("cld\n\t" __asm__ __volatile__(
"cld\n\t"
"repne\n\t" "repne\n\t"
"scasb\n\t" "scasb\n\t"
"decl %1\n\t" "decl %1\n\t"
...@@ -90,8 +94,9 @@ return dest; ...@@ -90,8 +94,9 @@ return dest;
extern inline int strcmp(const char * cs,const char * ct) extern inline int strcmp(const char * cs,const char * ct)
{ {
register int __res __asm__("ax"); register int __res;
__asm__("cld\n" __asm__ __volatile__(
"cld\n"
"1:\tlodsb\n\t" "1:\tlodsb\n\t"
"scasb\n\t" "scasb\n\t"
"jne 2f\n\t" "jne 2f\n\t"
...@@ -108,8 +113,9 @@ return __res; ...@@ -108,8 +113,9 @@ return __res;
extern inline int strncmp(const char * cs,const char * ct,size_t count) extern inline int strncmp(const char * cs,const char * ct,size_t count)
{ {
register int __res __asm__("ax"); register int __res;
__asm__("cld\n" __asm__ __volatile__(
"cld\n"
"1:\tdecl %3\n\t" "1:\tdecl %3\n\t"
"js 2f\n\t" "js 2f\n\t"
"lodsb\n\t" "lodsb\n\t"
...@@ -128,8 +134,9 @@ return __res; ...@@ -128,8 +134,9 @@ return __res;
extern inline char * strchr(const char * s,char c) extern inline char * strchr(const char * s,char c)
{ {
register char * __res __asm__("ax"); register char * __res;
__asm__("cld\n\t" __asm__ __volatile__(
"cld\n\t"
"movb %%al,%%ah\n" "movb %%al,%%ah\n"
"1:\tlodsb\n\t" "1:\tlodsb\n\t"
"cmpb %%ah,%%al\n\t" "cmpb %%ah,%%al\n\t"
...@@ -145,8 +152,9 @@ return __res; ...@@ -145,8 +152,9 @@ return __res;
extern inline char * strrchr(const char * s,char c) extern inline char * strrchr(const char * s,char c)
{ {
register char * __res __asm__("dx"); register char * __res;
__asm__("cld\n\t" __asm__ __volatile__(
"cld\n\t"
"movb %%al,%%ah\n" "movb %%al,%%ah\n"
"1:\tlodsb\n\t" "1:\tlodsb\n\t"
"cmpb %%ah,%%al\n\t" "cmpb %%ah,%%al\n\t"
...@@ -160,8 +168,9 @@ return __res; ...@@ -160,8 +168,9 @@ return __res;
extern inline size_t strspn(const char * cs, const char * ct) extern inline size_t strspn(const char * cs, const char * ct)
{ {
register char * __res __asm__("si"); register char * __res;
__asm__("cld\n\t" __asm__ __volatile__(
"cld\n\t"
"movl %4,%%edi\n\t" "movl %4,%%edi\n\t"
"repne\n\t" "repne\n\t"
"scasb\n\t" "scasb\n\t"
...@@ -184,8 +193,9 @@ return __res-cs; ...@@ -184,8 +193,9 @@ return __res-cs;
extern inline size_t strcspn(const char * cs, const char * ct) extern inline size_t strcspn(const char * cs, const char * ct)
{ {
register char * __res __asm__("si"); register char * __res;
__asm__("cld\n\t" __asm__ __volatile__(
"cld\n\t"
"movl %4,%%edi\n\t" "movl %4,%%edi\n\t"
"repne\n\t" "repne\n\t"
"scasb\n\t" "scasb\n\t"
...@@ -208,8 +218,9 @@ return __res-cs; ...@@ -208,8 +218,9 @@ return __res-cs;
extern inline char * strpbrk(const char * cs,const char * ct) extern inline char * strpbrk(const char * cs,const char * ct)
{ {
register char * __res __asm__("si"); register char * __res;
__asm__("cld\n\t" __asm__ __volatile__(
"cld\n\t"
"movl %4,%%edi\n\t" "movl %4,%%edi\n\t"
"repne\n\t" "repne\n\t"
"scasb\n\t" "scasb\n\t"
...@@ -235,8 +246,9 @@ return __res; ...@@ -235,8 +246,9 @@ return __res;
extern inline char * strstr(const char * cs,const char * ct) extern inline char * strstr(const char * cs,const char * ct)
{ {
register char * __res __asm__("ax"); register char * __res;
__asm__("cld\n\t" \ __asm__ __volatile__(
"cld\n\t" \
"movl %4,%%edi\n\t" "movl %4,%%edi\n\t"
"repne\n\t" "repne\n\t"
"scasb\n\t" "scasb\n\t"
...@@ -262,8 +274,9 @@ return __res; ...@@ -262,8 +274,9 @@ return __res;
extern inline size_t strlen(const char * s) extern inline size_t strlen(const char * s)
{ {
register int __res __asm__("cx"); register int __res;
__asm__("cld\n\t" __asm__ __volatile__(
"cld\n\t"
"repne\n\t" "repne\n\t"
"scasb\n\t" "scasb\n\t"
"notl %0\n\t" "notl %0\n\t"
...@@ -277,7 +290,8 @@ extern char * ___strtok; ...@@ -277,7 +290,8 @@ extern char * ___strtok;
extern inline char * strtok(char * s,const char * ct) extern inline char * strtok(char * s,const char * ct)
{ {
register char * __res; register char * __res;
__asm__("testl %1,%1\n\t" __asm__ __volatile__(
"testl %1,%1\n\t"
"jne 1f\n\t" "jne 1f\n\t"
"testl %0,%0\n\t" "testl %0,%0\n\t"
"je 8f\n\t" "je 8f\n\t"
...@@ -335,7 +349,8 @@ return __res; ...@@ -335,7 +349,8 @@ return __res;
extern inline void * memcpy(void * to, const void * from, size_t n) extern inline void * memcpy(void * to, const void * from, size_t n)
{ {
__asm__("cld\n\t" __asm__ __volatile__(
"cld\n\t"
"movl %%edx, %%ecx\n\t" "movl %%edx, %%ecx\n\t"
"shrl $2,%%ecx\n\t" "shrl $2,%%ecx\n\t"
"rep ; movsl\n\t" "rep ; movsl\n\t"
...@@ -355,14 +370,16 @@ return (to); ...@@ -355,14 +370,16 @@ return (to);
extern inline void * memmove(void * dest,const void * src, size_t n) extern inline void * memmove(void * dest,const void * src, size_t n)
{ {
if (dest<src) if (dest<src)
__asm__("cld\n\t" __asm__ __volatile__(
"cld\n\t"
"rep\n\t" "rep\n\t"
"movsb" "movsb"
: /* no output */ : /* no output */
:"c" (n),"S" (src),"D" (dest) :"c" (n),"S" (src),"D" (dest)
:"cx","si","di"); :"cx","si","di");
else else
__asm__("std\n\t" __asm__ __volatile__(
"std\n\t"
"rep\n\t" "rep\n\t"
"movsb\n\t" "movsb\n\t"
"cld" "cld"
...@@ -376,8 +393,9 @@ return dest; ...@@ -376,8 +393,9 @@ return dest;
extern inline int memcmp(const void * cs,const void * ct,size_t count) extern inline int memcmp(const void * cs,const void * ct,size_t count)
{ {
register int __res __asm__("ax"); register int __res;
__asm__("cld\n\t" __asm__ __volatile__(
"cld\n\t"
"repe\n\t" "repe\n\t"
"cmpsb\n\t" "cmpsb\n\t"
"je 1f\n\t" "je 1f\n\t"
...@@ -391,10 +409,11 @@ return __res; ...@@ -391,10 +409,11 @@ return __res;
extern inline void * memchr(const void * cs,char c,size_t count) extern inline void * memchr(const void * cs,char c,size_t count)
{ {
register void * __res __asm__("di"); register void * __res;
if (!count) if (!count)
return NULL; return NULL;
__asm__("cld\n\t" __asm__ __volatile__(
"cld\n\t"
"repne\n\t" "repne\n\t"
"scasb\n\t" "scasb\n\t"
"je 1f\n\t" "je 1f\n\t"
...@@ -407,7 +426,8 @@ return __res; ...@@ -407,7 +426,8 @@ return __res;
extern inline void * memset(void * s,char c,size_t count) extern inline void * memset(void * s,char c,size_t count)
{ {
__asm__("cld\n\t" __asm__ __volatile__(
"cld\n\t"
"rep\n\t" "rep\n\t"
"stosb" "stosb"
: /* no output */ : /* no output */
......
...@@ -17,6 +17,7 @@ struct semaphore { ...@@ -17,6 +17,7 @@ struct semaphore {
}; };
#define MUTEX ((struct semaphore) { 1, NULL }) #define MUTEX ((struct semaphore) { 1, NULL })
#define MUTEX_LOCKED ((struct semaphore) { 0, NULL })
struct select_table_entry { struct select_table_entry {
struct wait_queue wait; struct wait_queue wait;
......
...@@ -188,7 +188,6 @@ asmlinkage int sys_fork(struct pt_regs regs) ...@@ -188,7 +188,6 @@ asmlinkage int sys_fork(struct pt_regs regs)
(*p->binfmt->use_count)++; (*p->binfmt->use_count)++;
p->did_exec = 0; p->did_exec = 0;
p->swapping = 0;
p->kernel_stack_page = 0; p->kernel_stack_page = 0;
p->state = TASK_UNINTERRUPTIBLE; p->state = TASK_UNINTERRUPTIBLE;
p->flags &= ~(PF_PTRACED|PF_TRACESYS); p->flags &= ~(PF_PTRACED|PF_TRACESYS);
......
...@@ -23,12 +23,12 @@ SUBOBJS := $(foreach f,$(SUBDIRS),$f/$f.o) ...@@ -23,12 +23,12 @@ SUBOBJS := $(foreach f,$(SUBDIRS),$f/$f.o)
OBJS = socket.o protocols.o OBJS = socket.o protocols.o
all: subdirs net.o all: net.o
net.o: $(OBJS) network.a net.o: $(OBJS) network.a
$(LD) -r -o net.o $(OBJS) network.a $(LD) -r -o net.o $(OBJS) network.a
network.a: $(SUBOBJS) network.a: subdirs
rm -f $@ rm -f $@
ar rc $@ $(SUBOBJS) ar rc $@ $(SUBOBJS)
ranlib $@ ranlib $@
......
...@@ -155,7 +155,7 @@ ...@@ -155,7 +155,7 @@
#include <asm/segment.h> #include <asm/segment.h>
#include <linux/mm.h> #include <linux/mm.h>
#define TCP_FASTPATH #undef TCP_FASTPATH
#define SEQ_TICK 3 #define SEQ_TICK 3
unsigned long seq_offset; unsigned long seq_offset;
......
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