From 72542ac0a78c435292e477d240def3d11ed29341 Mon Sep 17 00:00:00 2001 From: Ben Gras Date: Wed, 7 Nov 2007 13:04:24 +0000 Subject: [PATCH] 3.1.3b tag. --- commands/reboot/halt.c | 2 +- commands/scripts/setup.sh | 2 +- commands/simple/mkfs.c | 7 ++++ drivers/dpeth/3c509.c | 4 +-- drivers/dpeth/dp.c | 24 +++++++++----- drivers/pci/main.c | 2 +- drivers/printer/Makefile | 2 +- drivers/printer/printer.c | 69 +++++++++++++++++++++++++++------------ etc/drivers.conf | 42 ++++++++++++++++-------- include/minix/com.h | 1 + include/minix/config.h | 2 +- servers/is/main.c | 4 +-- test/test17.c | 4 +-- tools/chrootmake.sh | 3 -- tools/mkboot | 16 +++++++-- tools/release.sh | 24 ++++++-------- 16 files changed, 135 insertions(+), 73 deletions(-) diff --git a/commands/reboot/halt.c b/commands/reboot/halt.c index 962e83b66..8cc385d81 100755 --- a/commands/reboot/halt.c +++ b/commands/reboot/halt.c @@ -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; } diff --git a/commands/scripts/setup.sh b/commands/scripts/setup.sh index 62dc9d818..49aac929d 100755 --- a/commands/scripts/setup.sh +++ b/commands/scripts/setup.sh @@ -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 diff --git a/commands/simple/mkfs.c b/commands/simple/mkfs.c index efcf3abe3..c6ee19719 100755 --- a/commands/simple/mkfs.c +++ b/commands/simple/mkfs.c @@ -33,6 +33,8 @@ #include #include +#define MAX_INODES (2*1024*1024) + #undef EXTERN #define EXTERN /* get rid of EXTERN by making it null */ #include "../../servers/mfs/super.h" @@ -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; diff --git a/drivers/dpeth/3c509.c b/drivers/dpeth/3c509.c index 14c89a526..ffa89ff08 100644 --- a/drivers/dpeth/3c509.c +++ b/drivers/dpeth/3c509.c @@ -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); diff --git a/drivers/dpeth/dp.c b/drivers/dpeth/dp.c index 73f6fa9a6..e569fd17a 100644 --- a/drivers/dpeth/dp.c +++ b/drivers/dpeth/dp.c @@ -1,6 +1,7 @@ #include /* -** 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 ** @@ -50,6 +51,11 @@ ** +------------+---------+---------+---------------+ ** ** $Id$ +** +** 2007-10-17: modified by jfdsmit@gmail.com +** 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" @@ -92,10 +98,10 @@ 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; @@ -103,7 +109,7 @@ static void reply(dpeth_t * dep, int err) 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) */; @@ -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; } @@ -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; } @@ -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; } @@ -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); } diff --git a/drivers/pci/main.c b/drivers/pci/main.c index 6fa300d56..0e00a70ee 100644 --- a/drivers/pci/main.c +++ b/drivers/pci/main.c @@ -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); diff --git a/drivers/printer/Makefile b/drivers/printer/Makefile index e216724ec..243bd0dec 100644 --- a/drivers/printer/Makefile +++ b/drivers/printer/Makefile @@ -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) diff --git a/drivers/printer/printer.c b/drivers/printer/printer.c index 61ab831fb..037268b41 100644 --- a/drivers/printer/printer.c +++ b/drivers/printer/printer.c @@ -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 */ @@ -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; @@ -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); + } } /*==========================================================================* @@ -389,8 +400,13 @@ 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; } @@ -398,7 +414,10 @@ PRIVATE void do_printer_output() /* 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 @@ -406,15 +425,21 @@ PRIVATE void do_printer_output() * 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--; @@ -422,7 +447,9 @@ PRIVATE void do_printer_output() /* 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; } } @@ -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); + } } diff --git a/etc/drivers.conf b/etc/drivers.conf index 2d3e01de0..33b1a7f17 100644 --- a/etc/drivers.conf +++ b/etc/drivers.conf @@ -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; +}; + + diff --git a/include/minix/com.h b/include/minix/com.h index dd34f3534..0ca2695ad 100755 --- a/include/minix/com.h +++ b/include/minix/com.h @@ -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 diff --git a/include/minix/config.h b/include/minix/config.h index 5ec003c9b..fa9939eba 100755 --- a/include/minix/config.h +++ b/include/minix/config.h @@ -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 diff --git a/servers/is/main.c b/servers/is/main.c index 37c08a64c..01c00cacf 100644 --- a/servers/is/main.c +++ b/servers/is/main.c @@ -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; diff --git a/test/test17.c b/test/test17.c index bf0310aee..92d5263dd 100644 --- a/test/test17.c +++ b/test/test17.c @@ -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); diff --git a/tools/chrootmake.sh b/tools/chrootmake.sh index 5243814e6..40d4b650e 100755 --- a/tools/chrootmake.sh +++ b/tools/chrootmake.sh @@ -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 diff --git a/tools/mkboot b/tools/mkboot index 1ad295e12..38ce132de 100755 --- a/tools/mkboot +++ b/tools/mkboot @@ -183,12 +183,24 @@ cdfdboot) mkdir /mnt/boot mkdir /mnt/boot/image ( cd /mnt/dev && sh /usr/src/commands/scripts/MAKEDEV.sh std ) - #cp -p image image_* /mnt/boot/image || exit 1 cp -p image /mnt/boot/image || exit 1 cp -p ../boot/boot /mnt/boot/boot || exit 1 umount $dev || exit 1 installboot -d $dev ../boot/bootblock boot/boot || exit 1 - edparams $dev 'unset bootopts; unset servers; disable=inet; image=/boot/image/image; bootbig(1, Regular MINIX 3) { image=/boot/image/image ; boot } bootsmall(2, Small MINIX 3 (uses less memory)) { image=/boot/image/image_small ; boot } cdproberoot=1; ata_id_timeout=2; unset rootdev; unset leader; leader() { echo \n--- Welcome to MINIX 3. This is the boot monitor. ---\n\nChoose an option from the menu or press ESC if you need to do anything special.\nOtherwise I will boot with my defaults in 10 seconds.\n\n }; bootcd=1; main(){trap 10000 boot; menu; }; save' || exit + edparams $dev ' +unset bootopts; +unset servers; +unset rootdev; +unset leader; +unset image; +disable=inet; +bootcd=1; +cdproberoot=1; +ata_id_timeout=2; +bootbig(1, MINIX 3) { unset image; boot } +leader() { echo \n--- Welcome to MINIX 3. This is the boot monitor. ---\n\nChoose an option from the menu or press ESC if you need to do anything special.\nOtherwise I will boot with my defaults in 10 seconds.\n\n }; +main(){trap 10000 boot; menu; }; +save' || exit # copy image dd if=$dev of=cdfdimage bs=8192 count=180 diff --git a/tools/release.sh b/tools/release.sh index ee6822534..d7de3ee86 100755 --- a/tools/release.sh +++ b/tools/release.sh @@ -50,8 +50,7 @@ disable=inet bios_wini=yes bios_remap_first=1 ramimagedev=c0d7p0s0 -bootbig(1, Regular MINIX 3) { image=/boot/image_big; boot } -bootsmall(2, Small MINIX 3 (<16MB)) {image=/boot/image_small; boot } +bootbig(1, MINIX 3) { image=/boot/image_big; boot } main() { trap 10000 boot ; menu; } save' | $RELEASEDIR/usr/bin/edparams $TMPDISK3 @@ -133,7 +132,7 @@ do esac done -USRMB=400 +USRMB=580 USRBLOCKS="`expr $USRMB \* 1024 \* 1024 / $BS`" USRSECTS="`expr $USRMB \* 1024 \* 2`" @@ -232,6 +231,7 @@ mkdir -m 755 $RELEASEDIR/usr mkdir -m 1777 $RELEASEDIR/tmp mount $TMPDISK2 $RELEASEDIR/tmp +echo making /usr mkfs -B $BS -b $USRBLOCKS $TMPDISK || exit echo " * Mounting $TMPDISK as $RELEASEDIR/usr" mount $TMPDISK $RELEASEDIR/usr || exit @@ -286,10 +286,11 @@ chmod -R u+w $RELEASEDIR/usr/lib if [ "$COPY" -ne 1 ] then echo " * Doing new svn export" - REPO=https://gforge.cs.vu.nl/svn/minix/trunk/$SRC + BRANCH=r3.1.3 + REPO=https://gforge.cs.vu.nl/svn/minix/branches/$BRANCH REVISION="`svn info $USERNAME $SVNREV $REPO | grep '^Revision: ' | awk '{ print $2 }'`" echo "Doing export of revision $REVISION from $REPO." - ( cd $RELEASEDIR/usr && svn $USERNAME export -r$REVISION $REPO ) + ( cd $RELEASEDIR/usr && svn $USERNAME export -r$REVISION $REPO && mv $BRANCH $SRC ) REVTAG=r$REVISION echo " @@ -326,7 +327,10 @@ if [ "$USB" -eq 0 ] then date >$RELEASEDIR/CD fi echo " * Chroot build" +cp chrootmake.sh $RELEASEDIR/usr/$SRC/tools/chrootmake.sh chroot $RELEASEDIR "PATH=/$XBIN sh -x /usr/$SRC/tools/chrootmake.sh" || exit 1 +# Copy built images for cd booting +cp $RELEASEDIR/boot/image_big image echo " * Chroot build done" echo " * Removing bootstrap files" rm -rf $RELEASEDIR/$XBIN @@ -359,17 +363,9 @@ rm $RELEASEDIR/.x umount $TMPDISK || exit umount $TMPDISK2 || exit umount $TMPDISK3 || exit + (cd ../boot && make) -(cd .. && make depend) -make clean -SVNVAR=EXTRA_OPTS=-D_SVN_REVISION='\\\"'$REVISION'\\\"' -make "$SVNVAR" image || exit 1 -mv image image_big -make clean -make "$SVNVAR" image_small || exit 1 dd if=$TMPDISK3 of=$ROOTIMAGE bs=$BS count=$ROOTBLOCKS -# Prepare image and image_small for cdfdboot -mv image_big image sh mkboot cdfdboot $TMPDISK3 cp $IMAGE $CDFILES/bootflop.img cp release/cd/* $CDFILES || true -- 2.44.0