mtd/docboot doc_bootstub.S,1.5,1.6 doc_bootstub.h,1.5,1.6

dbrown at infradead.org dbrown at infradead.org
Tue Apr 5 15:36:24 EDT 2005


Update of /home/cvs/mtd/docboot
In directory phoenix.infradead.org:/tmp/cvs-serv12865

Modified Files:
	doc_bootstub.S doc_bootstub.h 
Log Message:
Fix 16M limit test, add DEBUG_BUILD option.


Index: doc_bootstub.S
===================================================================
RCS file: /home/cvs/mtd/docboot/doc_bootstub.S,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- doc_bootstub.S	29 Mar 2005 21:01:54 -0000	1.5
+++ doc_bootstub.S	5 Apr 2005 19:36:21 -0000	1.6
@@ -78,24 +78,9 @@
 	popw	%ds
 	MSG(kernel_string)
 
-/*
-	mov	$0x88, %ah
-	int	$0x15
-	call	phword
-*/
-
 	cld
 
-	movw	setup_seg, %ax
-	movw	%ax, %es
-
-		/* gdt_src is currently set to 0x8000.  Add the setup base
-		   address to it, yielding a 32k offset from the start of the
-		   setup segment.  The math is simplified by the fact that
-		   setup_seg must be 1Kbyte aligned. */
-	shrw	$4, %ax
-	addw	%ax, gdt_src_mid
-
+	movw	setup_seg, %es
 	movw	doc_seg, %ds
 	movw	$BXREG, %bx
 	movw	$SIREG, %si
@@ -123,18 +108,22 @@
 	decw	%cs:low_sects
 	jnz	read_setup_sects
 
-#if 0
-		/* Print the kernel version string.  Partially for fun, mostly
-		   to show that we've loaded the low part and are about to
-		   load the high part. */
+#ifdef DEBUG_BUILD
+		/* Print the kernel version string. */
 	pushw	%ds
-	pushw	%es
-	popw	%ds
 	pushw	%si
 	pushw	%bx
+	pushw	%cs
+	popw	%ds
+	MSG(crlf_string)
+	pushw	%es
+	popw	%ds
 	movw	kernel_version, %si
 	addw	$0x200, %si
 	call	message
+	pushw	%cs
+	popw	%ds
+	MSG(kernel_string)
 	popw	%bx
 	popw	%si
 	popw	%ds
@@ -247,6 +236,18 @@
 nextpage:
 	popw	%di
 doc_readpage:
+#ifdef DEBUG_BUILD
+	pushw	%bx
+	movw	$4, %cx
+bsloop:
+	movw	$0x0001, %bx
+	movw	$0x0e08, %ax
+	int	$0x10
+	loop	bsloop
+	popw	%bx
+	movw	%dx, %ax
+	call	phword
+#endif
 #ifdef MILPLUS
 		/* Flash command:	Reset */
 	movb	$NAND_CMD_RESET, %al
@@ -375,7 +376,7 @@
 	ret
 
 /***************************************************************************/
-#if 0
+#ifdef DEBUG_BUILD
 
 phword:
 	pushw   %ax
@@ -437,10 +438,18 @@
                 .word   0
                 .skip   0x10
 
+#ifdef DEBUG_BUILD
+kernel_string:	.string "\n\rLoading kernel... page 0x????"
+initrd_string:	.string " Loading initrd... page 0x????"
+done_string:	.string " done.\n\rCommandline: "
+#else
 kernel_string:	.string "Loading kernel... "
 initrd_string:	.string "Loading initrd... "
 done_string:	.string "done.\n\rCommandline: "
+#endif
+
 boot_string:	.string "\n\rBooting!\n\r"
+crlf_string = (. - 3)
 
 checksum:
 setup_seg:	.word 0
@@ -499,13 +508,37 @@
 
 	MSG(installer_string)
 
+#ifdef DEBUG_BUILD
+	MSG(docseg_string)
+	movw	doc_seg, %ax
+	call	phword
+	MSG(setupseg_string)
+#endif
+
 		/* Store the setup segment */
-	movw	%cs, setup_seg
+	movw	%cs, %ax
+	movw	%ax, setup_seg
+#ifdef DEBUG_BUILD
+	call	phword
+#endif
+		/* gdt_src is currently set to 0x8000.  Add the setup base
+		   address to it, yielding a 32k offset from the start of the
+		   setup segment.  The math is simplified by the fact that
+		   setup_seg must be 1Kbyte aligned. */
+	shrw	$4, %ax
+	addw	%ax, gdt_src_mid
 
+
+#ifdef DEBUG_BUILD
+	MSG(int1588_string)
+#endif
 	movb	$0x88, %ah
 	int	$0x15		/* Get top of high mem (-1M) in 1k-blocks */
+#ifdef DEBUG_BUILD
+	call	phword
+#endif
 	cmpw	$(0x4000-0x400), %ax /* safety check: if it's above 15M ... */
-	jae	topmem_ok
+	jbe	topmem_ok
 	movw	$(0x4000-0x400), %ax /* ... replace with 15M. */
 topmem_ok:
 	addw	$0x400, %ax	/* Adjust for 1M offset */
@@ -514,6 +547,13 @@
 	shlw	$1, %ax		/* Convert to 256-byte blocks */
 	andw	$0xfff0, %ax	/* Round down to 4k block (req'd by kernel) */
 	movw	%ax, initrd_start	/* Store initrd start for later use */
+#ifdef DEBUG_BUILD
+	pushw	%ax
+	MSG(initrdstart_string)
+	popw	%ax
+	call	phword
+	MSG(lowmemtop_string)
+#endif
 
 	/* Now install the handler.  What we need to do is:
 	   1. Check the current end-of-memory in the BIOS
@@ -525,6 +565,9 @@
 		/* Find top of low memory */
 	movw	%dx, %ds
 	movw	0x0413, %ax
+#ifdef DEBUG_BUILD
+	call	phword
+#endif
 
 		/* Steal enough room from the top.  The line below is
 		   suboptimal for relocated code size of 2k bytes or less, but
@@ -549,11 +592,38 @@
 	rep
 	movsb
 
+#ifdef DEBUG_BUILD
+	pushw	%ax
+	MSG(handlerseg_string)
+	popw	%ax
+	call	phword
+	MSG(presskey_string)
+keydrain:
+	movb	$1, %ah
+	int	$0x16
+	movb	$0, %ah
+	jz	keywait
+	int	$0x16
+	jmp	keydrain
+keywait:
+	int	$0x16
+#endif
+
 skip_install:
 	lret	
 
 installer_string: .string "Installing DOCBoot.\n\r"
 
+#ifdef DEBUG_BUILD
+docseg_string: .string "doc_seg = 0x"
+setupseg_string: .string "    setup_seg = 0x"
+int1588_string: .string "\n\rint15/88 returns 0x"
+initrdstart_string: .string "    initrd_start = 0x"
+lowmemtop_string: .string "00\n\rtop of low mem = 0x"
+handlerseg_string: .string "k    handler seg = 0x"
+presskey_string: .string "\n\r  -- Press any key --\n\r"
+#endif
+
 install_end:
 
 	.balign	512, 0xff	/* Pad the entire stub to a 512-byte boundary */

Index: doc_bootstub.h
===================================================================
RCS file: /home/cvs/mtd/docboot/doc_bootstub.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- doc_bootstub.h	29 Mar 2005 21:07:28 -0000	1.5
+++ doc_bootstub.h	5 Apr 2005 19:36:21 -0000	1.6
@@ -155,6 +155,7 @@
 /* #define BIOS_EXTENSION */
 /* #define MILPLUS */
 /* #define OLD_DOC2K */
+/* #define DEBUG_BUILD */
 
 #ifdef OLD_DOC2K
   #define CDSN_CTRL_BASE CDSN_CTRL_FLASH_IO + CDSN_CTRL_WP + CDSN_CTRL_CE





More information about the linux-mtd-cvs mailing list