VERSION = 1
PATCHLEVEL = 1
-SUBLEVEL = 29
+SUBLEVEL = 30
all: Version zImage
! buffer cache as in minix (and especially now that the kernel is
! 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
! loads pretty fast by getting whole tracks at a time whenever possible.
jmpi go,INITSEG
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
! 12 is disk parm size
mov ds,ax
mov es,ax
mov ss,ax ! put stack at INITSEG:0x4000-12.
- mov sp,dx
+ mov sp,di
/*
* Many BIOS's default disk parameter tables will not
* recognize multi-sector reads beyond the maximum sector number
* Since single sector reads are slow and out of the question,
* we must take care of this by creating new parameter tables
* (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.
*
* Segments are as follows: ds=es=ss=cs - INITSEG,
- * fs = 0, gs = parameter table segment
+ * fs = 0, gs is unused.
*/
push #0
pop fs
mov bx,#0x78 ! fs:bx is parameter table address
+ push ds
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
cld
+ push di
rep
- seg gs
movsw
- mov di,dx
- movb 4(di),*18 ! patch sector count
+ pop di
+ pop ds
+
+ movb 4(di),*36 ! patch sector count
seg fs
mov (bx),di
seg fs
mov 2(bx),es
- mov ax,cs
- mov fs,ax
- mov gs,ax
-
xor ah,ah ! reset FDC
xor dl,dl
int 0x13
#else
! 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.
-! Otherwise guess 9.
+! 36 sectors if sector 36 can be read, 18 sectors if sector 18 can be read,
+! 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
- mov cx,#0x0012 ! sector 18, track 0
mov bx,#0x0200+SETUPSECS*0x200 ! address after setup (es = cs)
mov ax,#0x0201 ! service 2, 1 sector
int 0x13
- jnc got_sectors
- mov cl,#0x0f ! sector 15
- mov ax,#0x0201 ! service 2, 1 sector
- int 0x13
- jnc got_sectors
- mov cl,#0x09
+ jc probe_loop ! try next value
#endif
got_sectors:
- seg cs
- mov sectors,cx
+
+! Restore es
+
mov ax,#INITSEG
mov es,ax
! After that we check which root-device to use. If the device is
! defined (!= 0), nothing is done and the given device is used.
-! Otherwise, either /dev/PS0 (2,28) or /dev/at0 (2,8), depending
-! on the number of sectors that the BIOS reports currently.
+! Otherwise, one of /dev/fd0H2880 (2,32) or /dev/PS0 (2,28) or /dev/at0 (2,8),
+! depending on the number of sectors we pretend to know we have.
seg cs
mov ax,root_dev
mov ax,#0x0208 ! /dev/ps0 - 1.2Mb
cmp bx,#15
je root_defined
- mov ax,#0x021c ! /dev/PS0 - 1.44Mb
+ mov al,#0x1c ! /dev/PS0 - 1.44Mb
cmp bx,#18
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:
seg cs
mov root_dev,ax
push cx ! save count left
call print_nl ! nl for readability
- cmp cl, 5
+ cmp cl, #5
jae no_reg ! see if register name is needed
mov ax, #0xe05 + 'A - 1
mov dx, (bp) ! load word into dx
print_digit:
rol dx, #4 ! rotate so that lowest 4 bits are used
- mov ah, #0xe
- mov al, dl ! mask off so we have only next nibble
- and al, #0xf
- add al, #'0 ! convert to 0-based digit
- cmp al, #'9 ! check for overflow
- jbe good_digit
- add al, #'A - '0 - 10
-
-good_digit:
+ mov ax, #0xe0f ! ah = request, al = mask for nybble
+ and al, dl
+ add al, #0x90 ! convert al to ascii hex (four instructions)
+ daa
+ adc al, #0x40
+ daa
int 0x10
loop print_digit
ret
sectors:
.word 0
+disksizes:
+ .byte 36,18,15,9
+
msg1:
.byte 13,10
.ascii "Loading"
/*
* 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-
- * sector read/write can mess it up. It can contain one full track of
- * data (18*2*512 bytes).
+ * sector read/write can mess it up. It can contain one full cylinder (sic) of
+ * data (36*2*512 bytes).
*/
_floppy_track_buffer:
.fill 512*2*36,1,0
/*
* Ok, this is an expanded form so that we can use the same
* request for paging requests when that is implemented. In
- * paging, 'bh' is NULL, and 'waiting' is used to wait for
- * read/write completion.
+ * paging, 'bh' is NULL, and the semaphore is used to wait
+ * for read/write completion.
*/
struct request {
int dev; /* -1 if no request */
unsigned long nr_sectors;
unsigned long current_nr_sectors;
char * buffer;
- struct task_struct * waiting;
+ struct semaphore * sem;
struct buffer_head * bh;
struct buffer_head * bhtail;
struct request * next;
{
struct request * req;
struct buffer_head * bh;
- struct task_struct * p;
req = CURRENT;
req->errors = 0;
}
DEVICE_OFF(req->dev);
CURRENT = req->next;
- if ((p = req->waiting) != NULL) {
- req->waiting = NULL;
- p->swapping = 0;
- p->state = TASK_RUNNING;
- if (p->counter > current->counter)
- need_resched = 1;
- }
+ if (req->sem != NULL)
+ up(req->sem);
req->dev = -1;
wake_up(&wait_for_request);
}
* 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 FLOPPY_IRQ 6
{ 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 */
{ 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
* the disk, the next format is tried. This uses the variable 'probing'.
*/
-static struct floppy_struct floppy_types[] = {
- { 720, 9,2,40,0,0x2A,0x02,0xDF,0x50,"360k/PC" }, /* 360kB PC diskettes */
+#define NUMBER(x) (sizeof(x) / sizeof(*(x)))
+
+static struct floppy_struct floppy_type_1[] = {
{ 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 */
{ 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 */
+};
+
+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 */
{ 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 */
- { 2880,18,2,80,0,0x1B,0x40,0xCF,0x6C,"1.44MX" }, /* 1.44MB diskette */
+};
+
+#define floppy_type_6 floppy_type_5 /* 5 and 6 are the same */
+
+
+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. */
struct floppy_struct *current_type[4] = { NULL, NULL, NULL, NULL };
/* 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
* Track buffer and block buffer (in case track buffering doesn't work).
* Because these are written to by the DMA controller, they must
* not contain a 64k byte boundary crossing, or data will be
- * corrupted/lost. Alignment of these is enforced in boot/head.s.
- * Note that you must not change the sizes below without updating 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.
*/
extern char tmp_floppy_area[BLOCK_SIZE];
extern char floppy_track_buffer[512*2*MAX_BUFFER_SECTORS];
void request_done(int uptodate)
{
timer_active &= ~(1 << FLOPPY_TIMER);
+ probing = 0;
if (format_status != FORMAT_BUSY)
end_request(uptodate);
else {
{
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;
if (format_status == FORMAT_BUSY)
errors = ++format_errors;
}
}
seek = 0;
- probing = 0;
device = MINOR(CURRENT_DEVICE);
if (device > 3)
floppy = (device >> 2) + floppy_type;
else { /* Auto-detection */
- floppy = current_type[device & 3];
- if (!floppy) {
- probing = 1;
- floppy = base_type[device & 3];
+ if (!probing) {
+ floppy = current_type[device & 3];
if (!floppy) {
- request_done(0);
- goto repeat;
+ probing = 1;
+ floppy = base_type[device & 3];
+ if (!floppy) {
+ request_done(0);
+ goto repeat;
+ }
}
- if (CURRENT_ERRORS & 1)
- floppy++;
}
}
if (format_status != FORMAT_BUSY) {
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;
- if (code > 0 && code < 7) { /* -bb*/
- base = &floppy_types[(code-1)*2];
+ if (code > 0 && code <= NUMBER(floppy_types)) {
+ base = floppy_types[code-1];
printk("fd%d is %s",drive,base->name);
- return base;
- } else if (!code) {
+ base_type[drive] = base;
+ base_type_end[drive] = base + floppy_num_types[code-1];
+ } else if (!code)
printk("fd%d is not installed", drive);
- return NULL;
- }
- printk("fd%d is unknown type %d",drive,code);
- return NULL;
+ else
+ printk("fd%d is unknown type %d",drive,code);
}
static void config_types(void)
{
printk("Floppy drive(s): ");
- base_type[0] = find_base(0,(CMOS_READ(0x10) >> 4) & 15);
- if ((CMOS_READ(0x10) & 15) == 0)
- base_type[1] = NULL;
- else {
+ set_base_type(0, (CMOS_READ(0x10) >> 4) & 15);
+ if (CMOS_READ(0x10) & 15) {
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");
}
req = req->next;
while (req) {
if (req->dev == bh->b_dev &&
- !req->waiting &&
+ !req->sem &&
req->cmd == rw &&
req->sector + req->nr_sectors == sector &&
req->nr_sectors < 244)
}
if (req->dev == bh->b_dev &&
- !req->waiting &&
+ !req->sem &&
req->cmd == rw &&
req->sector - count == sector &&
req->nr_sectors < 244)
req->nr_sectors = count;
req->current_nr_sectors = count;
req->buffer = bh->b_data;
- req->waiting = NULL;
+ req->sem = NULL;
req->bh = bh;
req->bhtail = bh;
req->next = NULL;
{
struct request * req;
unsigned int major = MAJOR(dev);
+ struct semaphore sem = MUTEX_LOCKED;
if (major >= MAX_BLKDEV || !(blk_dev[major].request_fn)) {
printk("Trying to read nonexistent block-device %04x (%d)\n",dev,page*8);
req->nr_sectors = 8;
req->current_nr_sectors = 8;
req->buffer = buffer;
- req->waiting = current;
+ req->sem = &sem;
req->bh = NULL;
req->next = NULL;
- current->swapping = 1;
- current->state = TASK_SWAPPING;
add_request(major+blk_dev,req);
- /* The I/O may have inadvertently chagned the task state.
- Make sure we really wait until the I/O is done */
- if (current->swapping) current->state = TASK_SWAPPING;
- schedule();
+ down(&sem);
}
/* This function can be used to request a number of buffers from a block
int buffersize;
struct request * req;
unsigned int major = MAJOR(dev);
+ struct semaphore sem = MUTEX_LOCKED;
if (major >= MAX_BLKDEV || !(blk_dev[major].request_fn)) {
printk("ll_rw_swap_file: trying to swap nonexistent block-device\n");
req->nr_sectors = buffersize >> 9;
req->current_nr_sectors = buffersize >> 9;
req->buffer = buf;
- req->waiting = current;
+ req->sem = &sem;
req->bh = NULL;
req->next = NULL;
- current->swapping = 1;
- current->state = TASK_UNINTERRUPTIBLE;
add_request(major+blk_dev,req);
- /* The I/O may have inadvertently chagned the task state.
- Make sure we really wait until the I/O is done */
- if (current->swapping) current->state = TASK_UNINTERRUPTIBLE;
- schedule();
+ down(&sem);
}
}
include CONFIG
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
CPP := $(CPP) -I../../net/inet
endif
ifdef CONFIG_WD80x3
-NETDRV_OBJS := $(NETDRV_OBJS) net.a(wd.o)
+NETDRV_OBJS := $(NETDRV_OBJS) wd.o
CONFIG_8390 = CONFIG_8390
wd.o: wd.c CONFIG
$(CC) $(CPPFLAGS) $(CFLAGS) $(WD_OPTS) -c $<
endif
ifdef CONFIG_EL2
-NETDRV_OBJS := $(NETDRV_OBJS) net.a(3c503.o)
+NETDRV_OBJS := $(NETDRV_OBJS) 3c503.o
CONFIG_8390 = CONFIG_8390
3c503.o: 3c503.c CONFIG
$(CC) $(CPPFLAGS) $(CFLAGS) $(EL2_OPTS) -c $<
endif
ifdef CONFIG_NE2000
-NETDRV_OBJS := $(NETDRV_OBJS) net.a(ne.o)
+NETDRV_OBJS := $(NETDRV_OBJS) ne.o
CONFIG_8390 = CONFIG_8390
ne.o: ne.c CONFIG
$(CC) $(CPPFLAGS) $(CFLAGS) $(NE_OPTS) -c $<
endif
ifdef CONFIG_HPLAN
-NETDRV_OBJS := $(NETDRV_OBJS) net.a(hp.o)
+NETDRV_OBJS := $(NETDRV_OBJS) hp.o
CONFIG_8390 = CONFIG_8390
hp.o: hp.c CONFIG
$(CC) $(CPPFLAGS) $(CFLAGS) $(HP_OPTS) -c $<
endif
ifdef CONFIG_ULTRA
-NETDRV_OBJS := $(NETDRV_OBJS) net.a(smc-ultra.o)
+NETDRV_OBJS := $(NETDRV_OBJS) smc-ultra.o
CONFIG_8390 = CONFIG_8390
endif
ifdef CONFIG_E2100
-NETDRV_OBJS := $(NETDRV_OBJS) net.a(e2100.o)
+NETDRV_OBJS := $(NETDRV_OBJS) e2100.o
CONFIG_8390 = CONFIG_8390
endif
ifdef CONFIG_PLIP
-NETDRV_OBJS := $(NETDRV_OBJS) net.a(plip.o)
+NETDRV_OBJS := $(NETDRV_OBJS) plip.o
plip.o: plip.c CONFIG
$(CC) $(CPPFLAGS) $(CFLAGS) $(PLIP_OPTS) -c $<
endif
ifdef CONFIG_PPP
-NETDRV_OBJS := $(NETDRV_OBJS) net.a(ppp.o) net.a(slhc.o)
+NETDRV_OBJS := $(NETDRV_OBJS) ppp.o slhc.o
endif
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
$(CC) $(CPPFLAGS) $(CFLAGS) -c $<
endif
ifdef CONFIG_DE650
-NETDRV_OBJS := $(NETDRV_OBJS) net.a(de650.o)
+NETDRV_OBJS := $(NETDRV_OBJS) de650.o
CONFIG_8390 = CONFIG_8390
endif
ifdef CONFIG_3C589
-NETDRV_OBJS := $(NETDRV_OBJS) net.a(3c589.o)
+NETDRV_OBJS := $(NETDRV_OBJS) 3c589.o
endif
ifdef CONFIG_DUMMY
-NETDRV_OBJS := $(NETDRV_OBJS) net.a(dummy.o)
+NETDRV_OBJS := $(NETDRV_OBJS) dummy.o
dummy.o: dummy.c CONFIG
$(CC) $(CPPFLAGS) $(CFLAGS) -c $<
endif
ifdef CONFIG_DE600
-NETDRV_OBJS := $(NETDRV_OBJS) net.a(de600.o)
+NETDRV_OBJS := $(NETDRV_OBJS) de600.o
endif
de600.o: de600.c CONFIG
$(CC) $(CPPFLAGS) $(CFLAGS) $(DE600_OPTS) -c $<
$(CC) $(CPPFLAGS) $(CFLAGS) $(DE620_OPTS) -c $<
ifdef CONFIG_AT1500
-NETDRV_OBJS := $(NETDRV_OBJS) net.a(lance.o)
+NETDRV_OBJS := $(NETDRV_OBJS) lance.o
endif
ifdef CONFIG_LANCE
-NETDRV_OBJS := $(NETDRV_OBJS) net.a(lance.o)
+NETDRV_OBJS := $(NETDRV_OBJS) lance.o
endif
ifdef CONFIG_AT1700
-NETDRV_OBJS := $(NETDRV_OBJS) net.a(at1700.o)
+NETDRV_OBJS := $(NETDRV_OBJS) at1700.o
endif
ifdef CONFIG_EL1
-NETDRV_OBJS := $(NETDRV_OBJS) net.a(3c501.o)
+NETDRV_OBJS := $(NETDRV_OBJS) 3c501.o
endif
ifdef CONFIG_EL16
-NETDRV_OBJS := $(NETDRV_OBJS) net.a(3c507.o)
+NETDRV_OBJS := $(NETDRV_OBJS) 3c507.o
endif
ifdef CONFIG_EL3
-NETDRV_OBJS := $(NETDRV_OBJS) net.a(3c509.o)
+NETDRV_OBJS := $(NETDRV_OBJS) 3c509.o
endif
ifdef CONFIG_EEXPRESS
-NETDRV_OBJS := $(NETDRV_OBJS) net.a(eexpress.o)
+NETDRV_OBJS := $(NETDRV_OBJS) eexpress.o
endif
ifdef CONFIG_ZNET
-NETDRV_OBJS := $(NETDRV_OBJS) net.a(znet.o)
+NETDRV_OBJS := $(NETDRV_OBJS) znet.o
endif
ifdef CONFIG_DEPCA
-NETDRV_OBJS := $(NETDRV_OBJS) net.a(depca.o)
+NETDRV_OBJS := $(NETDRV_OBJS) depca.o
depca.o: depca.c CONFIG
$(CC) $(CPPFLAGS) $(CFLAGS) $(DEPCA_OPTS) -c $<
endif
ifdef CONFIG_ATP
-NETDRV_OBJS := $(NETDRV_OBJS) net.a(atp.o)
+NETDRV_OBJS := $(NETDRV_OBJS) atp.o
endif
ifdef CONFIG_NI52
-NETDRV_OBJS := $(NETDRV_OBJS) net.a(ni52.o)
+NETDRV_OBJS := $(NETDRV_OBJS) ni52.o
endif
ifdef CONFIG_NI65
-NETDRV_OBJS := $(NETDRV_OBJS) net.a(ni65.o)
+NETDRV_OBJS := $(NETDRV_OBJS) ni65.o
endif
ifdef CONFIG_ELPLUS
-NETDRV_OBJS := $(NETDRV_OBJS) net.a(3c505.o)
+NETDRV_OBJS := $(NETDRV_OBJS) 3c505.o
endif
ifdef CONFIG_AC3200
-NETDRV_OBJS := $(NETDRV_OBJS) net.a(ac3200.o)
+NETDRV_OBJS := $(NETDRV_OBJS) ac3200.o
CONFIG_8390 = CONFIG_8390
endif
ifdef CONFIG_APRICOT
endif
ifdef CONFIG_8390
-NETDRV_OBJS := $(NETDRV_OBJS) net.a(8390.o)
+NETDRV_OBJS := $(NETDRV_OBJS) 8390.o
endif
ifdef CONFIG_PI
-NETDRV_OBJS := $(NETDRV_OBJS) net.a(pi2.o)
+NETDRV_OBJS := $(NETDRV_OBJS) pi2.o
CONFIG_PI = CONFIG_PI
pi2.o: pi2.c CONFIG
$(CC) $(CPPFLAGS) $(CFLAGS) $(PI_OPTS) -c $<
endif
net.a: $(NETDRV_OBJS)
+ rm -f net.a
+ ar rc net.a $(NETDRV_OBJS)
ranlib net.a
clean:
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 &
scsi_result[1]) >> 7;
SDpnt->lockable = SDpnt->removable;
SCpnt->request.nr_sectors -= req->nr_sectors;
req->current_nr_sectors = bh->b_size >> 9;
req->buffer = bh->b_data;
- SCpnt->request.waiting = NULL; /* Wait until whole thing done */
+ SCpnt->request.sem = NULL; /* Wait until whole thing done */
} else {
req->dev = -1;
wake_up(&wait_for_request);
};
} else {
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->request.nr_sectors -= req->nr_sectors;
req->current_nr_sectors = bh->b_size >> 9;
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 {
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();
break;
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 */
- 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,
SCpnt->target,
SCpnt->lun,
SCpnt->internal_timeout,
SCpnt->cmnd[0],
SCpnt->sense_buffer[2],
- (SCpnt->request.waiting ?
- SCpnt->request.waiting->pid : 0),
SCpnt->result);
};
printk("wait_for_request = %x\n", wait_for_request);
printk("%d: ", i);
req = blk_dev[i].current_request;
while(req) {
- printk("(%x %d %d %d %d %d) ",
+ printk("(%x %d %d %d %d) ",
req->dev,
req->cmd,
req->sector,
req->nr_sectors,
- req->current_nr_sectors,
- (req->waiting ?
- req->waiting->pid : 0));
+ req->current_nr_sectors);
req = req->next;
}
printk("\n");
{
struct request * req;
struct buffer_head * bh;
- struct task_struct * p;
req = &SCpnt->request;
req->errors = 0;
return;
};
DEVICE_OFF(req->dev);
- if ((p = req->waiting) != NULL) {
- req->waiting = NULL;
- p->swapping = 0;
- p->state = TASK_RUNNING;
- if (p->counter > current->counter)
- need_resched = 1;
+ if (req->sem != NULL) {
+ up(req->sem);
}
req->dev = -1;
wake_up(&SCpnt->device->device_wait);
static void scsi_ioctl_done (Scsi_Cmnd * SCpnt)
{
struct request * req;
- struct task_struct * p;
req = &SCpnt->request;
req->dev = 0xfffe; /* Busy, but indicate request done */
- if ((p = req->waiting) != NULL) {
- req->waiting = NULL;
- p->state = TASK_RUNNING;
- if (p->counter > current->counter)
- need_resched = 1;
+ if (req->sem != NULL) {
+ up(req->sem);
}
}
MAX_RETRIES);
if (SCpnt->request.dev != 0xfffe){
- SCpnt->request.waiting = current;
- current->state = TASK_UNINTERRUPTIBLE;
+ struct semaphore sem = MUTEX_LOCKED;
+ SCpnt->request.sem = &sem;
+ down(&sem);
+ /* Hmm.. Have to ask about this one */
while (SCpnt->request.dev != 0xfffe) schedule();
};
MAX_RETRIES);
if (SCpnt->request.dev != 0xfffe){
- SCpnt->request.waiting = current;
- current->state = TASK_UNINTERRUPTIBLE;
+ struct semaphore sem = MUTEX_LOCKED;
+ SCpnt->request.sem = &sem;
+ down(&sem);
+ /* Hmm.. Have to ask about this one */
while (SCpnt->request.dev != 0xfffe) schedule();
};
static void sd_init_done (Scsi_Cmnd * SCpnt)
{
struct request * req;
- struct task_struct * p;
req = &SCpnt->request;
req->dev = 0xfffe; /* Busy, but indicate request done */
- if ((p = req->waiting) != NULL) {
- req->waiting = NULL;
- p->state = TASK_RUNNING;
- if (p->counter > current->counter)
- need_resched = 1;
+ if (req->sem != NULL) {
+ up(req->sem);
}
}
while(SCpnt->request.dev != 0xfffe);
else
if (SCpnt->request.dev != 0xfffe){
- SCpnt->request.waiting = current;
- current->state = TASK_UNINTERRUPTIBLE;
+ struct semaphore sem = MUTEX_LOCKED;
+ SCpnt->request.sem = &sem;
+ down(&sem);
+ /* Hmm.. Have to ask about this one.. */
while (SCpnt->request.dev != 0xfffe) schedule();
};
req = &SCpnt->request;
req->dev = 0xfffe; /* Busy, but indicate request done */
- if ((p = req->waiting) != NULL) {
- req->waiting = NULL;
- p->state = TASK_RUNNING;
- if (p->counter > current->counter)
- need_resched = 1;
+ if (req->sem != NULL) {
+ up(req->sem);
}
}
while(SCpnt->request.dev != 0xfffe);
else
if (SCpnt->request.dev != 0xfffe){
- SCpnt->request.waiting = current;
- current->state = TASK_UNINTERRUPTIBLE;
+ struct semaphore sem = MUTEX_LOCKED;
+ SCpnt->request.sem = &sem;
+ down(&sem);
+ /* Hmm.. Have to ask about this */
while (SCpnt->request.dev != 0xfffe) schedule();
};
req = &SCpnt->request;
req->dev = 0xfffe; /* Busy, but indicate request done */
- if ((p = req->waiting) != NULL) {
- req->waiting = NULL;
- p->state = TASK_RUNNING;
- if (p->counter > current->counter)
- need_resched = 1;
+ if (req->sem != NULL) {
+ up(&req->sem);
}
}
if (SCpnt->request.dev != 0xfffe){
- SCpnt->request.waiting = current;
- current->state = TASK_UNINTERRUPTIBLE;
+ struct semaphore sem = MUTEX_LOCKED;
+ SCpnt->request.sem = &sem;
+ down(&sem);
+ /* Hmm.. Have to ask about this */
while (SCpnt->request.dev != 0xfffe) schedule();
};
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)
return 0;
return 1;
if (de->namelen != len)
return 0;
- __asm__("cld\n\t"
+ __asm__ __volatile__(
+ "cld\n\t"
"repe ; cmpsb\n\t"
"setz %%al"
:"=a" (same)
time_t i_ctime;
unsigned long i_blksize;
unsigned long i_blocks;
+ unsigned long i_version;
struct semaphore i_sem;
struct inode_operations * i_op;
struct super_block * i_sb;
unsigned long personality;
int dumpable:1;
int did_exec:1;
- volatile int swapping:1;
int pid,pgrp,session,leader;
int groups[NGROUPS];
/*
/* schedlink */ &init_task,&init_task, \
/* signals */ {{ 0, },}, \
/* 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, \
/* suppl grps*/ {NOGROUP,}, \
/* proc links*/ &init_task,&init_task,NULL,NULL,NULL,NULL, \
extern inline char * strcpy(char * dest,const char *src)
{
-__asm__("cld\n"
+__asm__ __volatile__(
+ "cld\n"
"1:\tlodsb\n\t"
"stosb\n\t"
"testb %%al,%%al\n\t"
extern inline char * strncpy(char * dest,const char *src,size_t count)
{
-__asm__("cld\n"
+__asm__ __volatile__(
+ "cld\n"
"1:\tdecl %2\n\t"
"js 2f\n\t"
"lodsb\n\t"
extern inline char * strcat(char * dest,const char * src)
{
-__asm__("cld\n\t"
+__asm__ __volatile__(
+ "cld\n\t"
"repne\n\t"
"scasb\n\t"
"decl %1\n"
extern inline char * strncat(char * dest,const char * src,size_t count)
{
-__asm__("cld\n\t"
+__asm__ __volatile__(
+ "cld\n\t"
"repne\n\t"
"scasb\n\t"
"decl %1\n\t"
extern inline int strcmp(const char * cs,const char * ct)
{
-register int __res __asm__("ax");
-__asm__("cld\n"
+register int __res;
+__asm__ __volatile__(
+ "cld\n"
"1:\tlodsb\n\t"
"scasb\n\t"
"jne 2f\n\t"
extern inline int strncmp(const char * cs,const char * ct,size_t count)
{
-register int __res __asm__("ax");
-__asm__("cld\n"
+register int __res;
+__asm__ __volatile__(
+ "cld\n"
"1:\tdecl %3\n\t"
"js 2f\n\t"
"lodsb\n\t"
extern inline char * strchr(const char * s,char c)
{
-register char * __res __asm__("ax");
-__asm__("cld\n\t"
+register char * __res;
+__asm__ __volatile__(
+ "cld\n\t"
"movb %%al,%%ah\n"
"1:\tlodsb\n\t"
"cmpb %%ah,%%al\n\t"
extern inline char * strrchr(const char * s,char c)
{
-register char * __res __asm__("dx");
-__asm__("cld\n\t"
+register char * __res;
+__asm__ __volatile__(
+ "cld\n\t"
"movb %%al,%%ah\n"
"1:\tlodsb\n\t"
"cmpb %%ah,%%al\n\t"
extern inline size_t strspn(const char * cs, const char * ct)
{
-register char * __res __asm__("si");
-__asm__("cld\n\t"
+register char * __res;
+__asm__ __volatile__(
+ "cld\n\t"
"movl %4,%%edi\n\t"
"repne\n\t"
"scasb\n\t"
extern inline size_t strcspn(const char * cs, const char * ct)
{
-register char * __res __asm__("si");
-__asm__("cld\n\t"
+register char * __res;
+__asm__ __volatile__(
+ "cld\n\t"
"movl %4,%%edi\n\t"
"repne\n\t"
"scasb\n\t"
extern inline char * strpbrk(const char * cs,const char * ct)
{
-register char * __res __asm__("si");
-__asm__("cld\n\t"
+register char * __res;
+__asm__ __volatile__(
+ "cld\n\t"
"movl %4,%%edi\n\t"
"repne\n\t"
"scasb\n\t"
extern inline char * strstr(const char * cs,const char * ct)
{
-register char * __res __asm__("ax");
-__asm__("cld\n\t" \
+register char * __res;
+__asm__ __volatile__(
+ "cld\n\t" \
"movl %4,%%edi\n\t"
"repne\n\t"
"scasb\n\t"
extern inline size_t strlen(const char * s)
{
-register int __res __asm__("cx");
-__asm__("cld\n\t"
+register int __res;
+__asm__ __volatile__(
+ "cld\n\t"
"repne\n\t"
"scasb\n\t"
"notl %0\n\t"
extern inline char * strtok(char * s,const char * ct)
{
register char * __res;
-__asm__("testl %1,%1\n\t"
+__asm__ __volatile__(
+ "testl %1,%1\n\t"
"jne 1f\n\t"
"testl %0,%0\n\t"
"je 8f\n\t"
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"
"shrl $2,%%ecx\n\t"
"rep ; movsl\n\t"
extern inline void * memmove(void * dest,const void * src, size_t n)
{
if (dest<src)
-__asm__("cld\n\t"
+__asm__ __volatile__(
+ "cld\n\t"
"rep\n\t"
"movsb"
: /* no output */
:"c" (n),"S" (src),"D" (dest)
:"cx","si","di");
else
-__asm__("std\n\t"
+__asm__ __volatile__(
+ "std\n\t"
"rep\n\t"
"movsb\n\t"
"cld"
extern inline int memcmp(const void * cs,const void * ct,size_t count)
{
-register int __res __asm__("ax");
-__asm__("cld\n\t"
+register int __res;
+__asm__ __volatile__(
+ "cld\n\t"
"repe\n\t"
"cmpsb\n\t"
"je 1f\n\t"
extern inline void * memchr(const void * cs,char c,size_t count)
{
-register void * __res __asm__("di");
+register void * __res;
if (!count)
return NULL;
-__asm__("cld\n\t"
+__asm__ __volatile__(
+ "cld\n\t"
"repne\n\t"
"scasb\n\t"
"je 1f\n\t"
extern inline void * memset(void * s,char c,size_t count)
{
-__asm__("cld\n\t"
+__asm__ __volatile__(
+ "cld\n\t"
"rep\n\t"
"stosb"
: /* no output */
};
#define MUTEX ((struct semaphore) { 1, NULL })
+#define MUTEX_LOCKED ((struct semaphore) { 0, NULL })
struct select_table_entry {
struct wait_queue wait;
(*p->binfmt->use_count)++;
p->did_exec = 0;
- p->swapping = 0;
p->kernel_stack_page = 0;
p->state = TASK_UNINTERRUPTIBLE;
p->flags &= ~(PF_PTRACED|PF_TRACESYS);
OBJS = socket.o protocols.o
-all: subdirs net.o
+all: net.o
net.o: $(OBJS) network.a
$(LD) -r -o net.o $(OBJS) network.a
-network.a: $(SUBOBJS)
+network.a: subdirs
rm -f $@
ar rc $@ $(SUBOBJS)
ranlib $@
#include <asm/segment.h>
#include <linux/mm.h>
-#define TCP_FASTPATH
+#undef TCP_FASTPATH
#define SEQ_TICK 3
unsigned long seq_offset;