Skip site navigation (1)Skip section navigation (2)
Date:      2 Nov 2006 14:05:20 -0000
From:      Larry Baird <lab@gta.com>
To:        freebsd-embedded@freebsd.org
Subject:   Re: bootmgr on pc engines wrap board
Message-ID:  <20061102140520.66241.qmail@gta.com>
In-Reply-To: <BA04243B-9E9C-4E60-9525-21C90E52A6FB@develooper.com>

next in thread | previous in thread | raw e-mail | index | archive | help
In article <BA04243B-9E9C-4E60-9525-21C90E52A6FB@develooper.com> you wrote:
> Hi,
> 
> bootmgr hangs on the PC Engines WRAP board.
> 
> It's been brought up before on the small@ list (IIRC), but with no  
> solution.
> 
> It hangs just after
> 
> "1   FreeBSD
>  2   FreeBSD"
> 
> I have a stack of the WRAP boards I was going to use for the NTP  
> Pool, but I really want to use a nanobsd style install which needs  
> bootmgr - so I'm stuck.   Can anyone help?
You might be running into a problem I was recently fighting with.  I
had a number of WRAP boards running fine using software based upon 
freeBSD 4.x.  When trying to upgrad3 to software based upon 6.x
that kept stopping in boot2.  My results are different then yours in
that I would see "Read error" from boot1.  I initially tried setting
BOOT_BOOT1_FLAGS to 0.  If I remember correctly, this yielded identical
results to what you are seeing.  I then as a quick hack replaced the
read routine in /sys/boot/i386/boot2/boot1.S with the read routine
from 4.x.  This allowed me to boot.  Hopefully one day I'll get the
time to fully analyze the 6.x read assembly to understand if there
is a better fix.  Patch is below.

Index: boot1.S
===================================================================
--- boot1.S	(revision 8679)
+++ boot1.S	(working copy)
@@ -268,25 +268,7 @@
  * %dl	- byte     - drive number
  * stack - 10 bytes - EDD Packet
  */
-read:		testb $FL_PACKET,%cs:MEM_REL+flags-start # LBA support enabled?
-		jz read.1			# No, use CHS
-		cmpb $0x80,%dl			# Hard drive?
-		jb read.1			# No, use CHS
-		mov $0x55aa,%bx			# Magic
-		push %dx			# Save
-		movb $0x41,%ah			# BIOS: Check
-		int $0x13			#  extensions present
-		pop %dx				# Restore
-		jc read.1			# If error, use CHS
-		cmp $0xaa55,%bx			# Magic?
-		jne read.1			# No, so use CHS
-		testb $0x1,%cl			# Packet interface?
-		jz read.1			# No, so use CHS
-		mov %bp,%si			# Disk packet
-		movb $0x42,%ah			# BIOS: Extended
-		int $0x13			#  read
-		retw				# To caller
-read.1:	 	push %dx			# Save
+read:	 	push %dx			# Save
 		movb $0x8,%ah			# BIOS: Get drive
 		int $0x13			#  parameters
 		movb %dh,%ch			# Max head number
@@ -309,7 +291,7 @@
 		pop %dx				# Restore
 		cmpl $0x3ff,%eax		# Cylinder number supportable?
 		sti				# Enable interrupts
-		ja ereturn			# No, return an error
+		ja read.7			# No, try EDD
 		xchgb %al,%ah			# Set up cylinder
 		rorb $0x2,%al			#  number
 		orb %ch,%al			# Merge
@@ -320,11 +302,7 @@
 		mov 0x2(%bp),%ah		# Blocks to read
 		cmpb %ah,%al			# To read
 		jb read.2			#  this
-#ifdef	TRACK_AT_A_TIME
 		movb %ah,%al			#  track
-#else
-		movb $1,%al			#  one sector
-#endif
 read.2: 	mov $0x5,%di	 		# Try count
 read.3: 	les 0x4(%bp),%bx		# Transfer buffer
 		push %ax			# Save
@@ -345,8 +323,24 @@
 read.5: 	shlb %bl			#  buffer
 		add %bl,0x5(%bp)		#  pointer,
 		sub %al,0x2(%bp)		#  block count
-		ja read.1			# If not done
+		ja read				# If not done
 read.6: 	retw				# To caller
+read.7:		testb $FL_PACKET,%cs:MEM_REL+flags-start # LBA support enabled?
+		jz ereturn			# No, so return an error
+		mov $0x55aa,%bx			# Magic
+		push %dx			# Save
+		movb $0x41,%ah			# BIOS: Check
+		int $0x13			#  extensions present
+		pop %dx				# Restore
+		jc return			# If error, return an error
+		cmp $0xaa55,%bx			# Magic?
+		jne ereturn			# No, so return an error
+		testb $0x1,%cl			# Packet interface?
+		jz ereturn			# No, so return an error
+		mov %bp,%si			# Disk packet
+		movb $0x42,%ah			# BIOS: Extended
+		int $0x13			#  read
+		retw				# To caller
 
 /* Messages */
 

-- 
------------------------------------------------------------------------
Larry Baird                        | http://www.gta.com
Global Technology Associates, Inc. | Orlando, FL
Email: lab@gta.com                 | TEL 407-380-0220, FAX 407-380-6080



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20061102140520.66241.qmail>