diff -NurbP --minimal grub-0.93/configure grub-0.93-post/configure --- grub-0.93/configure Fri Nov 29 21:28:30 2002 +++ grub-0.93-post/configure Sun Mar 9 18:03:09 2003 @@ -892,6 +892,7 @@ --enable-diskless enable diskless support --disable-hercules disable hercules terminal support --disable-serial disable serial terminal support + --disable-parpost disable parport post support --enable-serial-speed-simulation simulate the slowness of a serial device --enable-preset-menu=FILE @@ -5154,6 +5155,21 @@ SERIAL_SUPPORT_FALSE= fi +# Check whether --enable-parpost or --disable-parpost was given. +if test "${enable_parpost+set}" = set; then + enableval="$enable_parpost" + +fi; + + +if test "x$enable_parpost" != xno; then + PARPOST_SUPPORT_TRUE= + PARPOST_SUPPORT_FALSE='#' +else + PARPOST_SUPPORT_TRUE='#' + PARPOST_SUPPORT_FALSE= +fi + # Check whether --enable-serial-speed-simulation or --disable-serial-speed-simulation was given. if test "${enable_serial_speed_simulation+set}" = set; then enableval="$enable_serial_speed_simulation" @@ -5925,6 +5941,8 @@ s,@HERCULES_SUPPORT_FALSE@,$HERCULES_SUPPORT_FALSE,;t t s,@SERIAL_SUPPORT_TRUE@,$SERIAL_SUPPORT_TRUE,;t t s,@SERIAL_SUPPORT_FALSE@,$SERIAL_SUPPORT_FALSE,;t t +s,@PARPOST_SUPPORT_TRUE@,$PARPOST_SUPPORT_TRUE,;t t +s,@PARPOST_SUPPORT_FALSE@,$PARPOST_SUPPORT_FALSE,;t t s,@SERIAL_SPEED_SIMULATION_TRUE@,$SERIAL_SPEED_SIMULATION_TRUE,;t t s,@SERIAL_SPEED_SIMULATION_FALSE@,$SERIAL_SPEED_SIMULATION_FALSE,;t t s,@BUILD_EXAMPLE_KERNEL_TRUE@,$BUILD_EXAMPLE_KERNEL_TRUE,;t t diff -NurbP --minimal grub-0.93/configure.in grub-0.93-post/configure.in --- grub-0.93/configure.in Fri Nov 29 21:12:08 2002 +++ grub-0.93-post/configure.in Sun Mar 9 18:03:09 2003 @@ -569,6 +569,11 @@ [ --disable-serial disable serial terminal support]) AM_CONDITIONAL(SERIAL_SUPPORT, test "x$enable_serial" != xno) +dnl Parport post +AC_ARG_ENABLE(parpost, + [ --disable-parpost disable parport post support]) +AM_CONDITIONAL(PARPOST_SUPPORT, test "x$enable_parpost" != xno) + dnl Simulation of the slowness of a serial device. AC_ARG_ENABLE(serial-speed-simulation, [ --enable-serial-speed-simulation diff -NurbP --minimal grub-0.93/grub/Makefile.am grub-0.93-post/grub/Makefile.am --- grub-0.93/grub/Makefile.am Tue Jun 11 14:49:46 2002 +++ grub-0.93-post/grub/Makefile.am Sun Mar 9 18:03:09 2003 @@ -8,6 +8,7 @@ AM_CFLAGS = $(GRUB_CFLAGS) -DGRUB_UTIL=1 -DFSYS_EXT2FS=1 -DFSYS_FAT=1 \ -DFSYS_FFS=1 -DFSYS_MINIX=1 -DSUPPORT_HERCULES=1 \ + -DSUPPORT_HERCULES=1 -DSUPPORT_PARPOST=1 \ $(SERIAL_FLAGS) \ -fwritable-strings -I$(top_srcdir)/stage2 \ -I$(top_srcdir)/stage1 -I$(top_srcdir)/lib diff -NurbP --minimal grub-0.93/grub/Makefile.in grub-0.93-post/grub/Makefile.in --- grub-0.93/grub/Makefile.in Fri Nov 29 21:28:54 2002 +++ grub-0.93-post/grub/Makefile.in Sun Mar 9 18:03:09 2003 @@ -93,6 +93,7 @@ AM_CFLAGS = $(GRUB_CFLAGS) -DGRUB_UTIL=1 -DFSYS_EXT2FS=1 -DFSYS_FAT=1 \ -DFSYS_FFS=1 -DFSYS_MINIX=1 -DSUPPORT_HERCULES=1 \ + -DSUPPORT_HERCULES=1 -DSUPPORT_PARPOST=1 \ $(SERIAL_FLAGS) \ -fwritable-strings -I$(top_srcdir)/stage2 \ -I$(top_srcdir)/stage1 -I$(top_srcdir)/lib diff -NurbP --minimal grub-0.93/grub/asmstub.c grub-0.93-post/grub/asmstub.c --- grub-0.93/grub/asmstub.c Tue Dec 3 00:20:45 2002 +++ grub-0.93-post/grub/asmstub.c Sun Mar 9 18:03:09 2003 @@ -70,6 +70,7 @@ unsigned long install_partition = 0x20000; unsigned long boot_drive = 0; int saved_entryno = 0; +unsigned short parport_base = 0x378; char version_string[] = VERSION; char config_file[128] = "/boot/grub/menu.lst"; /* FIXME: arbitrary */ unsigned long linux_text_len = 0; diff -NurbP --minimal grub-0.93/post.h grub-0.93-post/post.h --- grub-0.93/post.h Thu Jan 1 01:00:00 1970 +++ grub-0.93-post/post.h Sun Mar 9 18:13:08 2003 @@ -0,0 +1,33 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999, 2000 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef POST_HEADER +#define POST_HEADER 1 + +/* parport post values */ + +#define POST_STAGE1_LOADED 0xf0 + +#define POST_STAGE2_LOADED 0xef + +#define POST_TIMEOUT_EVEN 0xd0 +#define POST_TIMEOUT_ODD 0xdf + + +#endif /* POST_HEADER */ diff -NurbP --minimal grub-0.93/stage1/stage1.S grub-0.93-post/stage1/stage1.S --- grub-0.93/stage1/stage1.S Sun Sep 8 03:58:08 2002 +++ grub-0.93-post/stage1/stage1.S Sun Mar 9 18:03:09 2003 @@ -19,6 +19,7 @@ */ #include +#include /* * defines for the code go here @@ -101,6 +102,9 @@ .long 1 stage2_segment: .word 0x800 +parport_base: + .word 0x378 + after_BPB: @@ -123,6 +127,15 @@ /* set up the REAL stack */ movw $STAGE1_STACKSEG, %sp + /* output stage 1 pattern to parport */ + + pushw %dx + movw parport_base, %dx + movb $POST_STAGE1_LOADED, %al + outb %al, %dx + xorw %ax, %ax + popw %dx + sti /* we're safe again */ /* diff -NurbP --minimal grub-0.93/stage1/stage1.h grub-0.93-post/stage1/stage1.h --- grub-0.93/stage1/stage1.h Sun Sep 8 03:58:09 2002 +++ grub-0.93-post/stage1/stage1.h Sun Mar 9 18:03:09 2003 @@ -51,6 +51,9 @@ /* The offset of STAGE2_SEGMENT. */ #define STAGE1_STAGE2_SEGMENT 0x48 +/* The parallel port base addr. */ +#define STAGE1_PARPORT_BASE 0x4a + /* The offset of a magic number used by Windows NT. */ #define STAGE1_WINDOWS_NT_MAGIC 0x1b8 diff -NurbP --minimal grub-0.93/stage2/Makefile.am grub-0.93-post/stage2/Makefile.am --- grub-0.93/stage2/Makefile.am Fri Nov 29 19:00:53 2002 +++ grub-0.93-post/stage2/Makefile.am Sun Mar 9 18:03:09 2003 @@ -7,7 +7,7 @@ fat.h filesys.h freebsd.h fs.h hercules.h i386-elf.h \ imgact_aout.h jfs.h mb_header.h mb_info.h md5.h nbi.h \ pc_slice.h serial.h shared.h smp-imps.h term.h terminfo.h \ - tparm.h nbi.h vstafs.h xfs.h + tparm.h nbi.h vstafs.h xfs.h parpost.h EXTRA_DIST = setjmp.S apm.S $(noinst_SCRIPTS) # For . @@ -18,11 +18,11 @@ libgrub_a_SOURCES = boot.c builtins.c char_io.c cmdline.c common.c \ disk_io.c fsys_ext2fs.c fsys_fat.c fsys_ffs.c fsys_jfs.c \ fsys_minix.c fsys_reiserfs.c fsys_vstafs.c fsys_xfs.c gunzip.c \ - md5.c serial.c stage2.c terminfo.c tparm.c + md5.c serial.c stage2.c terminfo.c tparm.c parpost.c libgrub_a_CFLAGS = $(GRUB_CFLAGS) -I$(top_srcdir)/lib \ -DGRUB_UTIL=1 -DFSYS_EXT2FS=1 -DFSYS_FAT=1 -DFSYS_FFS=1 \ -DFSYS_JFS=1 -DFSYS_MINIX=1 -DFSYS_REISERFS=1 -DFSYS_VSTAFS=1 \ - -DFSYS_XFS=1 -DUSE_MD5_PASSWORDS=1 \ + -DFSYS_XFS=1 -DUSE_MD5_PASSWORDS=1 -DSUPPORT_PARPOST=1\ -DSUPPORT_SERIAL=1 -DSUPPORT_HERCULES=1 -fwritable-strings # Stage 2 and Stage 1.5's. @@ -69,6 +69,12 @@ SERIAL_FLAGS = endif +if PARPOST_SUPPORT +PARPOST_FLAGS = -DSUPPORT_PARPOST=1 +else +PARPOST_FLAGS = +endif + if HERCULES_SUPPORT HERCULES_FLAGS = -DSUPPORT_HERCULES=1 else @@ -76,7 +82,7 @@ endif STAGE2_COMPILE = $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ - $(NETBOOT_FLAGS) $(SERIAL_FLAGS) $(HERCULES_FLAGS) + $(NETBOOT_FLAGS) $(SERIAL_FLAGS) $(PARPOST_FLAGS) $(HERCULES_FLAGS) STAGE1_5_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,2000 STAGE1_5_COMPILE = $(STAGE2_COMPILE) -DNO_DECOMPRESSION=1 -DSTAGE1_5=1 @@ -86,7 +92,7 @@ cmdline.c common.c console.c disk_io.c fsys_ext2fs.c \ fsys_fat.c fsys_ffs.c fsys_jfs.c fsys_minix.c fsys_reiserfs.c \ fsys_vstafs.c fsys_xfs.c gunzip.c hercules.c md5.c serial.c \ - smp-imps.c stage2.c terminfo.c tparm.c + smp-imps.c stage2.c terminfo.c tparm.c parpost.c pre_stage2_exec_CFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS) pre_stage2_exec_ASFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS) pre_stage2_exec_LDFLAGS = $(PRE_STAGE2_LINK) diff -NurbP --minimal grub-0.93/stage2/Makefile.in grub-0.93-post/stage2/Makefile.in --- grub-0.93/stage2/Makefile.in Fri Nov 29 21:28:45 2002 +++ grub-0.93-post/stage2/Makefile.in Sun Mar 9 18:03:09 2003 @@ -98,7 +98,7 @@ fat.h filesys.h freebsd.h fs.h hercules.h i386-elf.h \ imgact_aout.h jfs.h mb_header.h mb_info.h md5.h nbi.h \ pc_slice.h serial.h shared.h smp-imps.h term.h terminfo.h \ - tparm.h nbi.h vstafs.h xfs.h + tparm.h nbi.h vstafs.h xfs.h parpost.h EXTRA_DIST = setjmp.S apm.S $(noinst_SCRIPTS) @@ -110,12 +110,12 @@ libgrub_a_SOURCES = boot.c builtins.c char_io.c cmdline.c common.c \ disk_io.c fsys_ext2fs.c fsys_fat.c fsys_ffs.c fsys_jfs.c \ fsys_minix.c fsys_reiserfs.c fsys_vstafs.c fsys_xfs.c gunzip.c \ - md5.c serial.c stage2.c terminfo.c tparm.c + md5.c serial.c stage2.c terminfo.c tparm.c parpost.c libgrub_a_CFLAGS = $(GRUB_CFLAGS) -I$(top_srcdir)/lib \ -DGRUB_UTIL=1 -DFSYS_EXT2FS=1 -DFSYS_FAT=1 -DFSYS_FFS=1 \ -DFSYS_JFS=1 -DFSYS_MINIX=1 -DFSYS_REISERFS=1 -DFSYS_VSTAFS=1 \ - -DFSYS_XFS=1 -DUSE_MD5_PASSWORDS=1 \ + -DFSYS_XFS=1 -DUSE_MD5_PASSWORDS=1 -DSUPPORT_PARPOST=1\ -DSUPPORT_SERIAL=1 -DSUPPORT_HERCULES=1 -fwritable-strings @@ -155,11 +155,14 @@ @SERIAL_SUPPORT_TRUE@SERIAL_FLAGS = -DSUPPORT_SERIAL=1 @SERIAL_SUPPORT_FALSE@SERIAL_FLAGS = +@PARPOST_SUPPORT_TRUE@PARPOST_FLAGS = -DSUPPORT_PARPOST=1 +@PARPOST_SUPPORT_FALSE@PARPOST_FLAGS = + @HERCULES_SUPPORT_TRUE@HERCULES_FLAGS = -DSUPPORT_HERCULES=1 @HERCULES_SUPPORT_FALSE@HERCULES_FLAGS = STAGE2_COMPILE = $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ - $(NETBOOT_FLAGS) $(SERIAL_FLAGS) $(HERCULES_FLAGS) + $(NETBOOT_FLAGS) $(SERIAL_FLAGS) $(PARPOST_FLAGS) $(HERCULES_FLAGS) STAGE1_5_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,2000 @@ -170,7 +173,7 @@ cmdline.c common.c console.c disk_io.c fsys_ext2fs.c \ fsys_fat.c fsys_ffs.c fsys_jfs.c fsys_minix.c fsys_reiserfs.c \ fsys_vstafs.c fsys_xfs.c gunzip.c hercules.c md5.c serial.c \ - smp-imps.c stage2.c terminfo.c tparm.c + smp-imps.c stage2.c terminfo.c tparm.c parpost.c pre_stage2_exec_CFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS) pre_stage2_exec_ASFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS) @@ -321,7 +324,8 @@ libgrub_a-fsys_vstafs.$(OBJEXT) libgrub_a-fsys_xfs.$(OBJEXT) \ libgrub_a-gunzip.$(OBJEXT) libgrub_a-md5.$(OBJEXT) \ libgrub_a-serial.$(OBJEXT) libgrub_a-stage2.$(OBJEXT) \ - libgrub_a-terminfo.$(OBJEXT) libgrub_a-tparm.$(OBJEXT) + libgrub_a-terminfo.$(OBJEXT) libgrub_a-tparm.$(OBJEXT) \ + libgrub_a-parpost.$(OBJEXT) libgrub_a_OBJECTS = $(am_libgrub_a_OBJECTS) EXTRA_PROGRAMS = nbloader.exec$(EXEEXT) pxeloader.exec$(EXEEXT) \ diskless.exec$(EXEEXT) @@ -367,7 +371,7 @@ diskless_exec-hercules.$(OBJEXT) diskless_exec-md5.$(OBJEXT) \ diskless_exec-serial.$(OBJEXT) diskless_exec-smp-imps.$(OBJEXT) \ diskless_exec-stage2.$(OBJEXT) diskless_exec-terminfo.$(OBJEXT) \ - diskless_exec-tparm.$(OBJEXT) + diskless_exec-tparm.$(OBJEXT) diskless_exec-parpost.$(OBJEXT) diskless_exec_OBJECTS = $(am_diskless_exec_OBJECTS) diskless_exec_DEPENDENCIES = ../netboot/libdrivers.a am_e2fs_stage1_5_exec_OBJECTS = e2fs_stage1_5_exec-start.$(OBJEXT) \ @@ -451,7 +455,8 @@ pre_stage2_exec-smp-imps.$(OBJEXT) \ pre_stage2_exec-stage2.$(OBJEXT) \ pre_stage2_exec-terminfo.$(OBJEXT) \ - pre_stage2_exec-tparm.$(OBJEXT) + pre_stage2_exec-tparm.$(OBJEXT) \ + pre_stage2_exec-parpost.$(OBJEXT) pre_stage2_exec_OBJECTS = $(am_pre_stage2_exec_OBJECTS) @NETBOOT_SUPPORT_TRUE@pre_stage2_exec_DEPENDENCIES = \ @NETBOOT_SUPPORT_TRUE@ ../netboot/libdrivers.a @@ -526,6 +531,7 @@ @AMDEP_TRUE@ $(DEPDIR)/diskless_exec-gunzip.Po \ @AMDEP_TRUE@ $(DEPDIR)/diskless_exec-hercules.Po \ @AMDEP_TRUE@ $(DEPDIR)/diskless_exec-md5.Po \ +@AMDEP_TRUE@ $(DEPDIR)/diskless_exec-parpost.Po \ @AMDEP_TRUE@ $(DEPDIR)/diskless_exec-serial.Po \ @AMDEP_TRUE@ $(DEPDIR)/diskless_exec-smp-imps.Po \ @AMDEP_TRUE@ $(DEPDIR)/diskless_exec-stage2.Po \ @@ -571,6 +577,7 @@ @AMDEP_TRUE@ $(DEPDIR)/libgrub_a-fsys_xfs.Po \ @AMDEP_TRUE@ $(DEPDIR)/libgrub_a-gunzip.Po \ @AMDEP_TRUE@ $(DEPDIR)/libgrub_a-md5.Po \ +@AMDEP_TRUE@ $(DEPDIR)/libgrub_a-parpost.Po \ @AMDEP_TRUE@ $(DEPDIR)/libgrub_a-serial.Po \ @AMDEP_TRUE@ $(DEPDIR)/libgrub_a-stage2.Po \ @AMDEP_TRUE@ $(DEPDIR)/libgrub_a-terminfo.Po \ @@ -600,6 +607,7 @@ @AMDEP_TRUE@ $(DEPDIR)/pre_stage2_exec-gunzip.Po \ @AMDEP_TRUE@ $(DEPDIR)/pre_stage2_exec-hercules.Po \ @AMDEP_TRUE@ $(DEPDIR)/pre_stage2_exec-md5.Po \ +@AMDEP_TRUE@ $(DEPDIR)/pre_stage2_exec-parpost.Po \ @AMDEP_TRUE@ $(DEPDIR)/pre_stage2_exec-serial.Po \ @AMDEP_TRUE@ $(DEPDIR)/pre_stage2_exec-smp-imps.Po \ @AMDEP_TRUE@ $(DEPDIR)/pre_stage2_exec-stage2.Po \ @@ -680,6 +688,7 @@ libgrub_a-stage2.$(OBJEXT): stage2.c libgrub_a-terminfo.$(OBJEXT): terminfo.c libgrub_a-tparm.$(OBJEXT): tparm.c +libgrub_a-parpost.$(OBJEXT): parpost.c libgrub.a: $(libgrub_a_OBJECTS) $(libgrub_a_DEPENDENCIES) -rm -f libgrub.a $(libgrub_a_AR) libgrub.a $(libgrub_a_OBJECTS) $(libgrub_a_LIBADD) @@ -712,6 +721,7 @@ diskless_exec-stage2.$(OBJEXT): stage2.c diskless_exec-terminfo.$(OBJEXT): terminfo.c diskless_exec-tparm.$(OBJEXT): tparm.c +diskless_exec-parpost.$(OBJEXT): parpost.c diskless.exec$(EXEEXT): $(diskless_exec_OBJECTS) $(diskless_exec_DEPENDENCIES) @rm -f diskless.exec$(EXEEXT) $(LINK) $(diskless_exec_LDFLAGS) $(diskless_exec_OBJECTS) $(diskless_exec_LDADD) $(LIBS) @@ -799,6 +809,7 @@ pre_stage2_exec-stage2.$(OBJEXT): stage2.c pre_stage2_exec-terminfo.$(OBJEXT): terminfo.c pre_stage2_exec-tparm.$(OBJEXT): tparm.c +pre_stage2_exec-parpost.$(OBJEXT): parpost.c pre_stage2.exec$(EXEEXT): $(pre_stage2_exec_OBJECTS) $(pre_stage2_exec_DEPENDENCIES) @rm -f pre_stage2.exec$(EXEEXT) $(LINK) $(pre_stage2_exec_LDFLAGS) $(pre_stage2_exec_OBJECTS) $(pre_stage2_exec_LDADD) $(LIBS) @@ -869,6 +880,7 @@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/diskless_exec-gunzip.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/diskless_exec-hercules.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/diskless_exec-md5.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/diskless_exec-parpost.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/diskless_exec-serial.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/diskless_exec-smp-imps.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/diskless_exec-stage2.Po@am__quote@ @@ -914,6 +926,7 @@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/libgrub_a-fsys_xfs.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/libgrub_a-gunzip.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/libgrub_a-md5.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/libgrub_a-parpost.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/libgrub_a-serial.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/libgrub_a-stage2.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/libgrub_a-terminfo.Po@am__quote@ @@ -943,6 +956,7 @@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/pre_stage2_exec-gunzip.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/pre_stage2_exec-hercules.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/pre_stage2_exec-md5.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/pre_stage2_exec-parpost.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/pre_stage2_exec-serial.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/pre_stage2_exec-smp-imps.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/pre_stage2_exec-stage2.Po@am__quote@ @@ -1354,6 +1368,18 @@ @AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-tparm.obj `cygpath -w tparm.c` +libgrub_a-parpost.o: parpost.c +@AMDEP_TRUE@ source='parpost.c' object='libgrub_a-parpost.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/libgrub_a-parpost.Po' tmpdepfile='$(DEPDIR)/libgrub_a-parpost.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-parpost.o `test -f parpost.c || echo '$(srcdir)/'`parpost.c + +libgrub_a-parpost.obj: parpost.c +@AMDEP_TRUE@ source='parpost.c' object='libgrub_a-parpost.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/libgrub_a-parpost.Po' tmpdepfile='$(DEPDIR)/libgrub_a-parpost.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-parpost.obj `cygpath -w parpost.c` + diskless_exec-bios.o: bios.c @AMDEP_TRUE@ source='bios.c' object='diskless_exec-bios.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@ depfile='$(DEPDIR)/diskless_exec-bios.Po' tmpdepfile='$(DEPDIR)/diskless_exec-bios.TPo' @AMDEPBACKSLASH@ @@ -1642,6 +1668,18 @@ @AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-tparm.obj `cygpath -w tparm.c` +diskless_exec-parpost.o: parpost.c +@AMDEP_TRUE@ source='parpost.c' object='diskless_exec-parpost.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/diskless_exec-parpost.Po' tmpdepfile='$(DEPDIR)/diskless_exec-parpost.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-parpost.o `test -f parpost.c || echo '$(srcdir)/'`parpost.c + +diskless_exec-parpost.obj: parpost.c +@AMDEP_TRUE@ source='parpost.c' object='diskless_exec-parpost.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/diskless_exec-parpost.Po' tmpdepfile='$(DEPDIR)/diskless_exec-parpost.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-parpost.obj `cygpath -w parpost.c` + e2fs_stage1_5_exec-common.o: common.c @AMDEP_TRUE@ source='common.c' object='e2fs_stage1_5_exec-common.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@ depfile='$(DEPDIR)/e2fs_stage1_5_exec-common.Po' tmpdepfile='$(DEPDIR)/e2fs_stage1_5_exec-common.TPo' @AMDEPBACKSLASH@ @@ -2289,6 +2327,18 @@ @AMDEP_TRUE@ depfile='$(DEPDIR)/pre_stage2_exec-tparm.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-tparm.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-tparm.obj `cygpath -w tparm.c` + +pre_stage2_exec-parpost.o: parpost.c +@AMDEP_TRUE@ source='parpost.c' object='pre_stage2_exec-parpost.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/pre_stage2_exec-parpost.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-parpost.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-parpost.o `test -f parpost.c || echo '$(srcdir)/'`parpost.c + +pre_stage2_exec-parpost.obj: parpost.c +@AMDEP_TRUE@ source='parpost.c' object='pre_stage2_exec-parpost.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/pre_stage2_exec-parpost.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-parpost.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-parpost.obj `cygpath -w parpost.c` reiserfs_stage1_5_exec-common.o: common.c @AMDEP_TRUE@ source='common.c' object='reiserfs_stage1_5_exec-common.o' libtool=no @AMDEPBACKSLASH@ diff -NurbP --minimal grub-0.93/stage2/asm.S grub-0.93-post/stage2/asm.S --- grub-0.93/stage2/asm.S Tue Dec 3 00:18:56 2002 +++ grub-0.93-post/stage2/asm.S Sun Mar 9 18:03:09 2003 @@ -37,6 +37,7 @@ #define ASM_FILE #include "shared.h" +#include "post.h" #ifdef STAGE1_5 # define ABS(x) ((x) - EXT_C(main) + 0x2200) @@ -93,6 +94,8 @@ .byte STAGE2_ID VARIABLE(force_lba) .byte 0 +VARIABLE(parport_base) + .word 0 VARIABLE(version_string) .string VERSION VARIABLE(config_file) @@ -130,6 +133,17 @@ /* set up the real mode/BIOS stack */ movl $STACKOFF, %ebp movl %ebp, %esp + + /* set stage 2 parport flags ... */ + + pushw %dx + movw (0x7c00 + STAGE1_PARPORT_BASE), %dx + movw %dx, EXT_C(parport_base) + movb $POST_STAGE2_LOADED, %al + outb %al, %dx + + xorw %ax, %ax + popw %dx sti /* we're safe again */ diff -NurbP --minimal grub-0.93/stage2/builtins.c grub-0.93-post/stage2/builtins.c --- grub-0.93/stage2/builtins.c Wed Dec 4 05:41:57 2002 +++ grub-0.93-post/stage2/builtins.c Sun Mar 9 18:03:09 2003 @@ -38,6 +38,11 @@ # include #endif +#ifdef SUPPORT_PARPOST +# include +# include +#endif + #ifdef GRUB_UTIL # include #else /* ! GRUB_UTIL */ @@ -3398,6 +3403,71 @@ #endif /* SUPPORT_SERIAL */ +#ifdef SUPPORT_PARPOST +/* parallel port post */ +static int +parpost_func (char *arg, int flags) +{ + int value = 0; + unsigned short port_bases[] = { 0x378, 0x278, 0x3BC }; + + /* Process GNU-style long options. + FIXME: We should implement a getopt-like function, to avoid + duplications. */ + while (1) + { + if (grub_memcmp (arg, "--unit=", sizeof ("--unit=") - 1) == 0) + { + char *p = arg + sizeof ("--unit=") - 1; + int unit; + + if (! safe_parse_maxint (&p, &unit)) + return 1; + + if (unit < 0 || unit > 2) + { + errnum = ERR_DEV_VALUES; + return 1; + } + + set_parport_base(port_bases[unit]); + } + else + break; + + arg = skip_to (0, arg); + } + + /* If no argument is specified, show current setting. */ + if (! *arg) + { + grub_printf ("parport_base = 0x%x\n", + get_parport_base()); + return 0; + } + + if (! safe_parse_maxint (&arg, &value)) + { + errnum = ERR_BAD_ARGUMENT; + return 1; + } + parport_post(value & 0xff); + return 0; +} + +static struct builtin builtin_parpost = +{ + "parpost", + parpost_func, + BUILTIN_MENU | BUILTIN_CMDLINE | BUILTIN_HELP_LIST, + "parpost [--unit=UNIT] [value]", + "Set post value at parport. UNIT is a digit that specifies which serial" + " device is used (0 == 0x378, 1 == 0x278, 2 == 0x3bc). If no value is" + " specified, print current parport base." +}; +#endif /* SUPPORT_PARPOST */ + + /* setkey */ struct keysym { @@ -4100,8 +4170,13 @@ } time2 = time1; + if (to > 0) to--; +#ifdef SUPPORT_PARPOST + parport_post((to%2)? + POST_TIMEOUT_ODD : POST_TIMEOUT_EVEN); +#endif } } } @@ -4704,6 +4779,9 @@ &builtin_module, &builtin_modulenounzip, &builtin_pager, +#ifdef SUPPORT_PARPOST + &builtin_parpost, +#endif /* SUPPORT_PARPOST */ &builtin_partnew, &builtin_parttype, &builtin_password, diff -NurbP --minimal grub-0.93/stage2/parpost.c grub-0.93-post/stage2/parpost.c --- grub-0.93/stage2/parpost.c Thu Jan 1 01:00:00 1970 +++ grub-0.93-post/stage2/parpost.c Sun Mar 9 18:03:09 2003 @@ -0,0 +1,68 @@ +/* parpost.c - parallel port device interface */ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2000,2001,2002 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifdef SUPPORT_PARPOST + +#include +#include +#include + + +#ifndef GRUB_UTIL + +/* Write a byte to a port. */ +static inline void +outb (unsigned short port, unsigned char value) +{ + asm volatile ("outb %b0, %w1" : : "a" (value), "Nd" (port)); + asm volatile ("outb %%al, $0x80" : : ); +} + +/* Output Status Nibbles to Parport */ +void +parport_post_lh (int ln, int hn) +{ + outb (parport_base + 0, + ((ln & 0xf) | ((hn & 0xf)<<4))); +} + +/* Output Status to Parport */ +void +parport_post (int v) +{ + outb (parport_base + 0, v); +} + + +#endif /* GRUB_UTIL */ + +void +set_parport_base (int base) +{ + parport_base = base; +} + +unsigned int +get_parport_base (void) +{ + return parport_base; +} + +#endif /* SUPPORT_PARPOST */ diff -NurbP --minimal grub-0.93/stage2/parpost.h grub-0.93-post/stage2/parpost.h --- grub-0.93/stage2/parpost.h Thu Jan 1 01:00:00 1970 +++ grub-0.93-post/stage2/parpost.h Sun Mar 9 18:03:09 2003 @@ -0,0 +1,40 @@ +/* parpost.h - serial device interface */ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2000,2001,2002 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef GRUB_PARPOST_HEADER +#define GRUB_PARPOST_HEADER 1 + +#ifndef GRUB_UTIL + +/* post a status low/high nibble. */ +void parport_post_lh (int ln, int hn); + +/* post a status byte. */ +void parport_post (int v); + +#else +# define parport_post_lh(l,h) while(0){} +# define parport_post(v) while(0){} +#endif + +void set_parport_base (int base); +unsigned int get_parport_base (void); + +#endif /* ! GRUB_PARPOST_HEADER */ diff -NurbP --minimal grub-0.93/stage2/shared.h grub-0.93-post/stage2/shared.h --- grub-0.93/stage2/shared.h Tue Dec 3 00:15:12 2002 +++ grub-0.93-post/stage2/shared.h Sun Mar 9 18:03:09 2003 @@ -193,7 +193,8 @@ #define STAGE2_SAVED_ENTRYNO 0xc #define STAGE2_STAGE2_ID 0x10 #define STAGE2_FORCE_LBA 0x11 -#define STAGE2_VER_STR_OFFS 0x12 +#define STAGE2_PARPORT_BASE 0x12 +#define STAGE2_VER_STR_OFFS 0x14 /* Stage 2 identifiers */ #define STAGE2_ID_STAGE2 0 @@ -544,6 +545,7 @@ extern unsigned long boot_part_addr; extern int saved_entryno; extern unsigned char force_lba; +extern unsigned short parport_base; extern char version_string[]; extern char config_file[]; extern unsigned long linux_text_len;