Skip to content

Commit

Permalink
3.1.3b tag.
Browse files Browse the repository at this point in the history
  • Loading branch information
bengras committed Nov 7, 2007
1 parent 818b1a2 commit 72542ac
Show file tree
Hide file tree
Showing 16 changed files with 135 additions and 73 deletions.
2 changes: 1 addition & 1 deletion commands/reboot/halt.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,6 @@ char **argv;
sync();

reboot(flag, monitor_code, strlen(monitor_code));
fprintf(stderr, "%s: reboot(): %s\n", strerror(errno));
fprintf(stderr, "%s: reboot(): %s\n", prog, strerror(errno));
return 1;
}
2 changes: 1 addition & 1 deletion commands/scripts/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ mount /dev/$usr /mnt >/dev/null || exit
# Make bootable.
installboot -d /dev/$root /usr/mdec/bootblock /boot/boot >/dev/null || exit

edparams /dev/$root "rootdev=$root; ramimagedev=$root; minix(1,Start MINIX 3) { image=/boot/image_big; boot; }; smallminix(2,Start Small MINIX 3 (uses less memory)) { image=/boot/image_small; boot; }; newminix(3,Start Custom MINIX 3) { unset image; boot }; main() { echo By default, MINIX 3 will automatically load in 3 seconds.; echo Press ESC to enter the monitor for special configuration.; trap 3000 boot; menu; }; save" || exit
edparams /dev/$root "rootdev=$root; ramimagedev=$root; minix(1,Start MINIX 3) { image=/boot/image_big; boot; }; newminix(2,Start Custom MINIX 3) { unset image; boot }; main() { echo By default, MINIX 3 will automatically load in 3 seconds.; echo Press ESC to enter the monitor for special configuration.; trap 3000 boot; menu; }; save" || exit
pfile="/mnt/src/tools/fdbootparams"
echo "rootdev=$root; ramimagedev=$root; save" >$pfile
# Save name of CD drive
Expand Down
7 changes: 7 additions & 0 deletions commands/simple/mkfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
#include <tools.h>
#include <dirent.h>

#define MAX_INODES (2*1024*1024)

#undef EXTERN
#define EXTERN /* get rid of EXTERN by making it null */
#include "../../servers/mfs/super.h"
Expand Down Expand Up @@ -317,6 +319,11 @@ char *argv[];
simple = 1;
}

if(inodes > MAX_INODES) {
inodes = MAX_INODES;
fprintf(stderr, "capping no. of inodes to %lu.\n", inodes);
}

nrblocks = blocks;
nrinodes = inodes;

Expand Down
4 changes: 2 additions & 2 deletions drivers/dpeth/3c509.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,10 @@ static void el3_write_fifo(dpeth_t * dep, int pktsize)
bytes = iovp->iod_iovec[ix].iov_size; /* Size of buffer */
if (bytes > pktsize) bytes = pktsize;
/* Writes from user buffer to Tx FIFO */
r= sys_safe_insb(dep->de_data_port, iovp->iod_proc_nr,
r= sys_safe_outsb(dep->de_data_port, iovp->iod_proc_nr,
iovp->iod_iovec[ix].iov_grant, 0, bytes);
if (r != OK)
panic(__FILE__, "el3_write_fifo: sys_safe_insb failed", r);
panic(__FILE__, "el3_write_fifo: sys_safe_outsb failed", r);

if (++ix >= IOVEC_NR) { /* Next buffer of IO vector */
dp_next_iovec(iovp);
Expand Down
24 changes: 15 additions & 9 deletions drivers/dpeth/dp.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include <assert.h>
/*
** File: eth.c Version 1.00, Jan. 14, 1997
** File: dp.c Version 1.01, Oct. 17, 2007
** Original: eth.c Version 1.00, Jan. 14, 1997
**
** Author: Giovanni Falzoni <[email protected]>
**
Expand Down Expand Up @@ -50,6 +51,11 @@
** +------------+---------+---------+---------------+
**
** $Id$
**
** 2007-10-17: modified by [email protected]
** added a third argument to the reply() function because not
** every reply should be of DL_TASK_REPLY (one should be
** DL_STAT_REPLY)
*/

#include "drivers.h"
Expand Down Expand Up @@ -92,18 +98,18 @@ static char DevName[] = "eth#?";
static void do_getname(message *mp);

/*
** Name: void reply(dpeth_t *dep, int err)
** Function: Fills a DL_TASK_REPLY reply message and sends it.
** Name: void reply(dpeth_t *dep, int err, int m_type)
** Function: Fills a reply message and sends it.
*/
static void reply(dpeth_t * dep, int err)
static void reply(dpeth_t * dep, int err, int m_type)
{
message reply;
int status = FALSE;

if (dep->de_flags & DEF_ACK_SEND) status |= DL_PACK_SEND;
if (dep->de_flags & DEF_ACK_RECV) status |= DL_PACK_RECV;

reply.m_type = DL_TASK_REPLY;
reply.m_type = m_type;
reply.DL_PORT = dep - de_table;
reply.DL_PROC = dep->de_client;
reply.DL_STAT = status /* | ((u32_t) err << 16) */;
Expand Down Expand Up @@ -423,7 +429,7 @@ static void do_vwrite_s(message * mp)
} else if (dep->de_mode == DEM_SINK)
dep->de_flags |= DEF_ACK_SEND;

reply(dep, OK);
reply(dep, OK, DL_TASK_REPLY);
return;
}

Expand Down Expand Up @@ -466,7 +472,7 @@ static void do_vread_s(message * mp)
dep->de_flags &= NOT(DEF_STOPPED);
#endif
}
reply(dep, OK);
reply(dep, OK, DL_TASK_REPLY);
return;
}

Expand All @@ -491,7 +497,7 @@ static void do_getstat_s(message * mp)
(vir_bytes)&dep->de_stat,
(vir_bytes) sizeof(dep->de_stat), 0)) != OK)
panic(DevName, CopyErrMsg, rc);
reply(dep, OK);
reply(dep, OK, DL_STAT_REPLY);
return;
}

Expand Down Expand Up @@ -623,7 +629,7 @@ PUBLIC int main(int argc, char **argv)
dep->de_int_pending = TRUE;
(*dep->de_interruptf) (dep);
if (dep->de_flags & (DEF_ACK_SEND | DEF_ACK_RECV))
reply(dep, !OK);
reply(dep, !OK, DL_TASK_REPLY);
dep->de_int_pending = FALSE;
sys_irqenable(&dep->de_hook);
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/pci/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ int main(void)
case BUSC_PCI_DEV_NAME_S: do_dev_name_s(&m); break;
case BUSC_PCI_SLOT_NAME_S: do_slot_name_s(&m); break;
case BUSC_PCI_ACL: do_acl(&m); break;
case PROC_EVENT: do_sig_handler(); break;
case PROC_EVENT: break;
default:
printf("PCI: got message from %d, type %d\n",
m.m_source, m.m_type);
Expand Down
2 changes: 1 addition & 1 deletion drivers/printer/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ OBJ = printer.o
all build: $(DRIVER)
$(DRIVER): $(OBJ)
$(CC) -o $@ $(LDFLAGS) $(OBJ) $(LIBS)
install -S 8k $(DRIVER)
install $(DRIVER)

# install with other drivers
install: /usr/sbin/$(DRIVER)
Expand Down
69 changes: 49 additions & 20 deletions drivers/printer/printer.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ PRIVATE int revive_status; /* revive status */
PRIVATE int done_status; /* status of last output completion */
PRIVATE int oleft; /* bytes of output left in obuf */
PRIVATE char obuf[128]; /* output buffer */
PRIVATE char *optr; /* ptr to next char in obuf to print */
PRIVATE unsigned char *optr; /* ptr to next char in obuf to print */
PRIVATE int orig_count; /* original byte count */
PRIVATE int port_base; /* I/O port for printer */
PRIVATE int proc_nr; /* user requesting the printing */
Expand Down Expand Up @@ -208,13 +208,16 @@ int safe; /* use virtual addresses or grant id's? */

retries = MAX_ONLINE_RETRIES + 1;
while (--retries > 0) {
sys_inb(port_base + 1, &status);
if(sys_inb(port_base + 1, &status) != OK) {
printf("printer: sys_inb of %x failed\n", port_base+1);
panic(__FILE__,"sys_inb failed", NO_NUM);
}
if ((status & ON_LINE)) { /* printer online! */
prepare_output();
do_printer_output();
return;
}
tickdelay(30); /* wait before retry */
tickdelay(HZ/2); /* wait before retry */
}
/* If we reach this point, the printer was not online in time. */
done_status = status;
Expand Down Expand Up @@ -331,16 +334,24 @@ PRIVATE void do_initialize()
initialized = TRUE;

/* Get the base port for first printer. */
sys_vircopy(SELF, BIOS_SEG, LPT1_IO_PORT_ADDR,
SELF, D, (vir_bytes) &port_base, LPT1_IO_PORT_SIZE);
sys_outb(port_base + 2, INIT_PRINTER);
tickdelay(1); /* easily satisfies Centronics minimum */
/* was 2 millisecs; now is ~17 millisecs */
sys_outb(port_base + 2, PR_SELECT);
if(sys_vircopy(SELF, BIOS_SEG, LPT1_IO_PORT_ADDR,
SELF, D, (vir_bytes) &port_base, LPT1_IO_PORT_SIZE) != OK) {
panic(__FILE__, "do_initialize: sys_vircopy failed", NO_NUM);
}
if(sys_outb(port_base + 2, INIT_PRINTER) != OK) {
printf("printer: sys_outb of %x failed\n", port_base+2);
panic(__FILE__, "do_initialize: sys_outb init failed", NO_NUM);
}
tickdelay(HZ/20); /* easily satisfies Centronics minimum */
if(sys_outb(port_base + 2, PR_SELECT) != OK) {
printf("printer: sys_outb of %x failed\n", port_base+2);
panic(__FILE__, "do_initialize: sys_outb select failed", NO_NUM);
}
irq_hook_id = 0;
sys_irqsetpolicy(PRINTER_IRQ, 0, &irq_hook_id);
sys_irqenable(&irq_hook_id);

if(sys_irqsetpolicy(PRINTER_IRQ, 0, &irq_hook_id) != OK ||
sys_irqenable(&irq_hook_id) != OK) {
panic(__FILE__, "do_initialize: irq enabling failed", NO_NUM);
}
}

/*==========================================================================*
Expand Down Expand Up @@ -389,40 +400,56 @@ PRIVATE void do_printer_output()
* when the printer is busy with a previous character, because the
* interrupt status does not affect the printer.
*/
sys_outb(port_base + 2, PR_SELECT);
sys_irqenable(&irq_hook_id);
if(sys_outb(port_base + 2, PR_SELECT) != OK) {
printf("printer: sys_outb of %x failed\n", port_base+2);
panic(__FILE__,"sys_outb failed", NO_NUM);
}
if(sys_irqenable(&irq_hook_id) != OK) {
panic(__FILE__,"sys_irqenable failed", NO_NUM);
}
return;
}

do {
/* Loop to handle fast (buffered) printers. It is important that
* processor interrupts are not disabled here, just printer interrupts.
*/
(void) sys_inb(port_base + 1, &status);
if(sys_inb(port_base + 1, &status) != OK) {
printf("printer: sys_inb of %x failed\n", port_base+1);
panic(__FILE__,"sys_inb failed", NO_NUM);
}
if ((status & STATUS_MASK) == BUSY_STATUS) {
/* Still busy with last output. This normally happens
* immediately after doing output to an unbuffered or slow
* printer. It may happen after a call from prepare_output or
* pr_restart, since they are not synchronized with printer
* interrupts. It may happen after a spurious interrupt.
*/
sys_irqenable(&irq_hook_id);
if(sys_irqenable(&irq_hook_id) != OK) {
panic(__FILE__, "sys_irqenable failed\n", NO_NUM);
}
return;
}
if ((status & STATUS_MASK) == NORMAL_STATUS) {
/* Everything is all right. Output another character. */
pv_set(char_out[0], port_base, *optr++);
pv_set(char_out[0], port_base, *optr);
optr++;
pv_set(char_out[1], port_base+2, ASSERT_STROBE);
pv_set(char_out[2], port_base+2, NEGATE_STROBE);
sys_voutb(char_out, 3); /* request series of port outb */
if(sys_voutb(char_out, 3) != OK) {
/* request series of port outb */
panic(__FILE__, "sys_voutb failed\n", NO_NUM);
}

user_vir_d++;
user_left--;
} else {
/* Error. This would be better ignored (treat as busy). */
done_status = status;
output_done();
sys_irqenable(&irq_hook_id);
if(sys_irqenable(&irq_hook_id) != OK) {
panic(__FILE__, "sys_irqenable failed\n", NO_NUM);
}
return;
}
}
Expand All @@ -431,6 +458,8 @@ PRIVATE void do_printer_output()
/* Finished printing chunk OK. */
done_status = OK;
output_done();
sys_irqenable(&irq_hook_id);
if(sys_irqenable(&irq_hook_id) != OK) {
panic(__FILE__, "sys_irqenable failed\n", NO_NUM);
}
}

42 changes: 28 additions & 14 deletions etc/drivers.conf
Original file line number Diff line number Diff line change
Expand Up @@ -159,24 +159,38 @@ driver mfs

driver printer
{
io 408:2 # LPT1
40a:2 # LPT2
40c:2 # LPT3
40e:2 # LPT4
io 378:4 # LPT1
278:4 # LPT2
;
irq
7 # PRINTER_IRQ
7 # PRINTER_IRQ
;
system
KILL # 6
SETGRANT # 34
UMAP # 14
VIRCOPY # 15
IRQCTL # 19
DEVIO # 21
VDEVIO # 23
SAFECOPYFROM # 31
SAFECOPYTO # 32
KILL # 6
SETGRANT # 34
UMAP # 14
VIRCOPY # 15
IRQCTL # 19
DEVIO # 21
VDEVIO # 23
SAFECOPYFROM # 31
SAFECOPYTO # 32
;
};

driver dpeth
{
system
IRQCTL # 19
DEVIO # 21
SDEVIO # 22
SETALARM # 24
GETINFO # 26
SAFECOPYFROM # 31
SAFECOPYTO # 32
SETGRANT # 34
;
uid 0;
};


1 change: 1 addition & 0 deletions include/minix/com.h
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@
#define DL_CONF_REPLY (DL_RS_BASE + 20)
#define DL_TASK_REPLY (DL_RS_BASE + 21)
#define DL_NAME_REPLY (DL_RS_BASE + 22)
#define DL_STAT_REPLY (DL_RS_BASE + 23)

/* Field names for data link layer messages. */
#define DL_PORT m2_i1
Expand Down
2 changes: 1 addition & 1 deletion include/minix/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

/* Minix release and version numbers. */
#define OS_RELEASE "3"
#define OS_VERSION "1.3a"
#define OS_VERSION "1.3b"

/* This file sets configuration parameters for the MINIX kernel, FS, and PM.
* It is divided up into two main sections. The first section contains
Expand Down
4 changes: 2 additions & 2 deletions servers/is/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ PUBLIC int main(int argc, char **argv)
}
continue;
case PROC_EVENT:
sig_handler();
continue;
result = EDONTREPLY;
break;
case FKEY_PRESSED:
result = do_fkey_pressed(&m_in);
break;
Expand Down
4 changes: 2 additions & 2 deletions test/test17.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ char *argv[];
exit(1);
}

system("rm -rf DIR_18; mkdir DIR_18");
chdir("DIR_18");
system("rm -rf DIR_17; mkdir DIR_17");
chdir("DIR_17");

mask = (argc == 2 ? atoi(argv[1]) : 0xFFFF);

Expand Down
3 changes: 0 additions & 3 deletions tools/chrootmake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ rm /boot/image/*
make install
cp /boot/image/* /boot/image_big # Make big image accessible by this name
cp ../boot/boot /boot/boot
make clean
make image_small
cp image_small /boot
cd /usr/src
make clean
# Let man find the manpages
Expand Down
Loading

0 comments on commit 72542ac

Please sign in to comment.