MAKE = exec make
CC = exec cc
CFLAGS = -I$i $(CPROFILE)
-LDFLAGS = -i
-LIBS = -lsysutil -lsys -ltimers
+LDFLAGS = -i -L../libdriver
+LIBS = -lsysutil -lsys -ltimers -ldriver
OBJ = at_wini.o
-LIBDRIVER = $d/libdriver/driver.o $d/libdriver/drvlib.o
# build local binary
all build: $(DRIVER)
-$(DRIVER): $(OBJ) $(LIBDRIVER)
- $(CC) -o $@ $(LDFLAGS) $(OBJ) $(LIBDRIVER) $(LIBS)
+$(DRIVER): $(OBJ)
+ $(CC) -o $@ $(LDFLAGS) $(OBJ) $(LIBS)
install -S 32k $(DRIVER)
-$(LIBDRIVER):
- cd $d/libdriver && $(MAKE)
-
# install with other drivers
install: /sbin/$(DRIVER)
/sbin/$(DRIVER): $(DRIVER)
message m;
if (w_wn->irq != NO_IRQ) {
- /* Wait for an interrupt that sets w_status to "not busy". */
+ /* Wait for an interrupt that sets w_status to "not busy".
+ * (w_timeout() also clears w_status.)
+ */
while (w_wn->w_status & (STATUS_ADMBSY|STATUS_BSY)) {
int rr;
- if((rr=receive(HARDWARE, &m)) != OK) { /* expect HARD_INT message */
- printf("w_intr_wait: receive from ANY failed (%d)\n",
- r);
- continue; /* try again */
+ if((rr=receive(ANY, &m)) != OK)
+ panic("at_wini", "receive(ANY) failed", rr);
+ switch(m.m_type) {
+ case SYN_ALARM:
+ /* Timeout. */
+ w_timeout(); /* a.o. set w_status */
+ break;
+ case HARD_INT:
+ /* Interrupt. */
+ r= sys_inb(w_wn->base_cmd + REG_STATUS, &w_status);
+ if (r != 0)
+ panic("at_wini", "sys_inb failed", r);
+ w_wn->w_status= w_status;
+ ack_irqs(m.NOTIFY_ARG);
+ break;
+ case DEV_PING:
+ /* RS monitor ping. */
+ notify(m.m_source);
+ break;
+ default:
+ /* unhandled message.
+ * queue it and handle it in the libdriver loop.
+ */
+ mq_queue(&m);
}
- if (m.m_type == SYN_ALARM) { /* but check for timeout */
- w_timeout(); /* a.o. set w_status */
- } else if (m.m_type == HARD_INT) {
- r= sys_inb(w_wn->base_cmd + REG_STATUS, &w_status);
- if (r != 0)
- panic("at_wini", "sys_inb failed", r);
- w_wn->w_status= w_status;
- ack_irqs(m.NOTIFY_ARG);
- } else if (m.m_type == DEV_PING) {
- notify(m.m_source);
- } else {
- printf("AT_WINI got unexpected message %d from %d\n",
- m.m_type, m.m_source);
- }
}
} else {
/* Interrupt not yet allocated; use polling. */
wn->w_status |= STATUS_ADMBSY; /* Assume not done yet. */
return(r);
}
+
#endif /* ENABLE_ATAPI */
+
MAKE = exec make
CC = exec cc
CFLAGS = -I$i $(CPROFILE)
-LDFLAGS = -i
-LIBS = -lsysutil -lsys -ltimers
+LDFLAGS = -i -L../libdriver
+LIBS = -lsysutil -lsys -ltimers -ldriver
OBJ = bios_wini.o
-LIBDRIVER = $d/libdriver/driver.o $d/libdriver/drvlib.o
-
# build local binary
all build: $(DRIVER)
-$(DRIVER): $(OBJ) $(LIBDRIVER)
- $(CC) -o $@ $(LDFLAGS) $(OBJ) $(LIBDRIVER) $(LIBS)
+$(DRIVER): $(OBJ)
+ $(CC) -o $@ $(LDFLAGS) $(OBJ) $(LIBS)
install -S 8k $(DRIVER)
-$(LIBDRIVER):
- cd $d/libdriver && $(MAKE)
-
# install with other drivers
install: /sbin/$(DRIVER)
/sbin/$(DRIVER): $(DRIVER)
MAKE = exec make
CC = exec cc
CFLAGS = -I$i $(CPROFILE)
-LDFLAGS = -i
-LIBS = -lsysutil -lsys
+LDFLAGS = -i -L../libdriver
+LIBS = -lsysutil -lsys -ldriver
OBJ = cmos.o
-LIBDRIVER = $d/libdriver/driver.o
-
# build local binary
all build: $(DRIVER)
-$(DRIVER): $(OBJ) $(LIBDRIVER)
- $(CC) -o $@ $(LDFLAGS) $(OBJ) $(LIBDRIVER) $(LIBS)
+$(DRIVER): $(OBJ)
+ $(CC) -o $@ $(LDFLAGS) $(OBJ) $(LIBS)
install -S 8k $(DRIVER)
-$(LIBDRIVER):
- cd $d/libdriver && $(MAKE)
-
-
# install with other drivers
install: /sbin/$(DRIVER)
/sbin/$(DRIVER): $(DRIVER)
MAKE = exec make
CC = exec cc
CFLAGS = -I$i $(CPROFILE)
-LDFLAGS = -i
-LIBS = -lsysutil -lsys -ltimers
+LDFLAGS = -i -L../libdriver
+LIBS = -lsysutil -ldriver -lsys -ltimers
OBJ = floppy.o
-LIBDRIVER = $d/libdriver/driver.o $d/libdriver/drvlib.o
# build local binary
all build: $(DRIVER)
-$(DRIVER): $(OBJ) $(LIBDRIVER)
- $(CC) -o $@ $(LDFLAGS) $(OBJ) $(LIBDRIVER) $(LIBS)
+$(DRIVER): $(OBJ)
+ $(CC) -o $@ $(LDFLAGS) $(OBJ) $(LIBS)
install -S 8k $(DRIVER)
-$(LIBDRIVER):
- cd $d/libdriver && $(MAKE)
-
# install with other drivers
install: /sbin/$(DRIVER)
/sbin/$(DRIVER): $(DRIVER)
CFLAGS = -I$i $(CPROFILE)
LDFLAGS = -i
LIBS = -lsysutil -lsys
+LIB = libdriver.a
-OBJECTS = driver.o drvlib.o
+OBJECTS = driver.o drvlib.o mq.o
-all build install: $(OBJECTS)
+all build install: $(LIB)
+
+$(LIB): $(OBJECTS)
+ ar rc $(LIB) $(OBJECTS)
# $(CC) -c $@ $(LDFLAGS) $(OBJ) $(LIBS)
clean:
- rm -f *.o *.bak
+ rm -f *.o *.bak *.a
depend:
/usr/bin/mkdep "$(CC) -E $(CPPFLAGS)" *.c > .depend
#include "../drivers.h"
#include <sys/ioc_disk.h>
+#include <minix/mq.h>
#include "driver.h"
#if (CHIP == INTEL)
FORWARD _PROTOTYPE( int do_vrdwt, (struct driver *dr, message *mp, int safe) );
int device_caller;
+PRIVATE mq_t *queue_head = NULL;
/*===========================================================================*
* driver_task *
int r, proc_nr;
message mess;
+ /* Init MQ library. */
+ mq_init();
+
/* Get a DMA buffer. */
init_buffer();
* it out, and sends a reply.
*/
while (TRUE) {
-
- /* Wait for a request to read or write a disk block. */
- if (receive(ANY, &mess) != OK) continue;
+ /* Any queued messages? Oldest are at the head. */
+ if(queue_head) {
+ mq_t *mq;
+ mq = queue_head;
+ memcpy(&mess, &mq->mq_mess, sizeof(mess));
+ queue_head = queue_head->mq_next;
+ mq_free(mq);
+ } else {
+ int s;
+ /* Wait for a request to read or write a disk block. */
+ if ((s=receive(ANY, &mess)) != OK)
+ panic((*dp->dr_name)(),"receive() failed", s);
+ }
device_caller = mess.m_source;
proc_nr = mess.IO_ENDPT;
}
return(OK);
}
+
+/*===========================================================================*
+ * mq_queue *
+ *===========================================================================*/
+PUBLIC int mq_queue(message *m)
+{
+ mq_t *mq, *mi;
+
+ if(!(mq = mq_get()))
+ panic("libdriver","mq_queue: mq_get failed", NO_NUM);
+ memcpy(&mq->mq_mess, m, sizeof(mq->mq_mess));
+ mq->mq_next = NULL;
+ if(!queue_head) {
+ queue_head = mq;
+ } else {
+ for(mi = queue_head; mi->mq_next; mi = mi->mq_next)
+ ;
+ mi->mq_next = mq;
+ }
+
+ return OK;
+}
+
_PROTOTYPE( int nop_select, (struct driver *dp, message *m_ptr) );
_PROTOTYPE( int do_diocntl, (struct driver *dp, message *m_ptr, int safe) );
_PROTOTYPE( int nop_ioctl, (struct driver *dp, message *m_ptr, int safe) );
+_PROTOTYPE( int mq_queue, (message *m_ptr) );
/* Parameters for the disk drive. */
#define SECTOR_SIZE 512 /* physical sector size in bytes */
--- /dev/null
+/*
+inet/mq.c
+
+Created: Jan 3, 1992 by Philip Homburg
+
+Copyright 1995 Philip Homburg
+*/
+
+#include <ansi.h>
+#include <assert.h>
+
+#include <minix/config.h>
+#include <minix/const.h>
+#include <minix/type.h>
+#include <minix/ipc.h>
+#include <minix/mq.h>
+
+#define MQ_SIZE 128
+
+PRIVATE mq_t mq_list[MQ_SIZE];
+PRIVATE mq_t *mq_freelist;
+
+void mq_init()
+{
+ int i;
+
+ mq_freelist= NULL;
+ for (i= 0; i<MQ_SIZE; i++)
+ {
+ mq_list[i].mq_next= mq_freelist;
+ mq_freelist= &mq_list[i];
+ mq_list[i].mq_allocated= 0;
+ }
+}
+
+mq_t *mq_get()
+{
+ mq_t *mq;
+
+ mq= mq_freelist;
+ assert(mq != NULL);
+
+ mq_freelist= mq->mq_next;
+ mq->mq_next= NULL;
+ assert(mq->mq_allocated == 0);
+ mq->mq_allocated= 1;
+ return mq;
+}
+
+void mq_free(mq)
+mq_t *mq;
+{
+ mq->mq_next= mq_freelist;
+ mq_freelist= mq;
+ assert(mq->mq_allocated == 1);
+ mq->mq_allocated= 0;
+}
+
+/*
+ * $PchId: mq.c,v 1.7 1998/10/23 20:10:47 philip Exp $
+ */
MAKE = exec make
CC = exec cc
CFLAGS = -I$i $(CPROFILE)
-LDFLAGS = -i
-LIBS = -lsysutil -lsys
+LDFLAGS = -i -L../libdriver
+LIBS = -lsysutil -ldriver -lsys
OBJ = log.o diag.o kputc.o
-LIBDRIVER = $d/libdriver/driver.o
-
# build local binary
all build: $(DRIVER)
-$(DRIVER): $(OBJ) $(LIBDRIVER)
- $(CC) -o $@ $(LDFLAGS) $(OBJ) $(LIBDRIVER) $(LIBS)
+$(DRIVER): $(OBJ)
+ $(CC) -o $@ $(LDFLAGS) $(OBJ) $(LIBS)
install -S 16kb $(DRIVER)
-$(LIBDRIVER):
- cd $d/libdriver && $(MAKE)
-
# install with other drivers
install: $(DRIVER)
install -o root -cs $? /sbin/$(DRIVER)
MAKE = exec make
CC = exec cc
CFLAGS = -I$i
-LDFLAGS = -i
-LIBS = -lsysutil -lsys
+LDFLAGS = -i -L../libdriver
+LIBS = -lsysutil -ldriver -lsys
# imgrd_s.s is the ACK assembler version of the ramdisk. For more portability,
# use the C version imgrd.c. However, the C compiler takes too much memory
#IMGRD=imgrd.c
OBJ = memory.o allocmem.o $(IMGRD)
-LIBDRIVER = $d/libdriver/driver.o
-
# build local binary
all build: $(DRIVER)
-$(DRIVER): ramdisk_image $(OBJ) $(LIBDRIVER)
- $(CC) -o $@ $(LDFLAGS) $(OBJ) $(LIBDRIVER) $(LIBS)
+$(DRIVER): ramdisk_image $(OBJ)
+ $(CC) -o $@ $(LDFLAGS) $(OBJ) $(LIBS)
install -S 8k $(DRIVER)
imgrd.o: ramdisk/image.c
imgrd_s.o: ramdisk/image.s
TMPDIR=/usr/tmp $(CC) -T /usr/tmp -c imgrd_s.s
-$(LIBDRIVER):
- cd $d/libdriver && $(MAKE)
-
ramdisk_image:
cd ramdisk && make
MAKE = exec make
CC = exec cc
CFLAGS = -I$i $(CPROFILE)
-LDFLAGS = -i
-LIBS = -lsysutil -lsys
+LDFLAGS = -i -L../libdriver
+LIBS = -lsysutil -ldriver -lsys
OBJ = main.o random.o sha2.o aes/rijndael_api.o aes/rijndael_alg.o
-LIBDRIVER = $d/libdriver/driver.o
-
# build local binary
all build: $(DRIVER)
-$(DRIVER): $(OBJ) $(LIBDRIVER)
- $(CC) -o $@ $(LDFLAGS) $(OBJ) $(LIBDRIVER) $(LIBS)
+$(DRIVER): $(OBJ)
+ $(CC) -o $@ $(LDFLAGS) $(OBJ) $(LIBS)
install -S 8k $(DRIVER)
-$(LIBDRIVER):
- cd $d/libdriver && $(MAKE)
-
aes/rijndael_api.o:
$(CC) -c -o $@ aes/rijndael_api.c
--- /dev/null
+/*
+inet/mq.h
+
+Created: Jan 3, 1992 by Philip Homburg
+
+Copyright 1995 Philip Homburg
+*/
+
+#ifndef INET__MQ_H
+#define INET__MQ_H
+
+typedef struct mq
+{
+ message mq_mess;
+ struct mq *mq_next;
+ int mq_allocated;
+} mq_t;
+
+_PROTOTYPE( mq_t *mq_get, (void) );
+_PROTOTYPE( void mq_free, (mq_t *mq) );
+_PROTOTYPE( void mq_init, (void) );
+
+#endif /* INET__MQ_H */
+
+/*
+ * $PchId: mq.h,v 1.4 1995/11/21 06:40:30 philip Exp $
+ */