Re: LBA vs CHS?

Dave Huang <[email protected]> Sun, 19 Nov 2023 03:14:29 -0600 (CST)
Newsgroups gmane.os.netbsd.ports.i386
Message-ID <[email protected]>
On Sat, 18 Nov 2023, Mouse wrote:
> But, upon trying to install on it, bootxx_ffsv1 was having trouble
> loading /boot.  I've been sprinkling debugging around.  It is
> definitely reading the wrong blocks off the CF "disk"...and it appears
> that the BIOS call it's using, int 0x13 function 2, is ignoring the
> cylinder number.  (I'm doing this with my mutant 5.2, but this is all
> about bootxx_ffsv1 code, so, unless bootxx_ffsv1 has been substantially
> worked over, I doubt the OS rev matters.)

I don't know about it ignoring the cylinder number, but int 13h function 
02h is limited to approximately 8GB (1024 cyl * 256 heads * 63 sectors * 
512 bytes), so I'd expect the boot code to use int 13h function 42h for 
larger disks. I see a biosdisk_extread routine in 
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/i386/stand/lib/bios_disk.S?rev=1.18&content-type=text/x-cvsweb-markup&only_with_tag=MAIN 
so the code exists in 5.2. I haven't looked to see when it's used 
though. Although I'd also expect function 2 to work for reading below 
the 1024 cylinder limit (such as your example of cyl 1 head 4 sec 19).

I ran NetBSD on a Soekris net4501, but with an 8GB CF card. I never had 
any problems with it booting, but I don't know if it ever had to load 
anything from other than cyl 0. However, it seems likely that it would 
have... one cylinder is only about 8MB, right? It seems unlikely that 
the kernel would have always been on the first 8MB of the card.

-- 
Name: Dave Huang         |  Mammal, mammal / their names are called /
INet: [email protected] |  they raise a paw / the bat, the cat /
                          |  dolphin and dog / koala bear and hog -- TMBG
Dahan: Hani G Y+C 48 Y++ L+++ W- C++ T++ A+ E+ S++ V++ F- Q+++ P+ B+ PA+ PL++