Home | History | Annotate | only in /src/sys/arch/macppc/stand/ofwboot
History log of /src/sys/arch/macppc/stand/ofwboot
RevisionDateAuthorComments
 1.35 28-Feb-2021  thorpej - When starting the boot program, cache a bunch of OFW frequently used
ihandles / phandles, rather than fetching them all the time.
- Change the signature of OF_call_method() to take an array of cells for
the inputs and outputs, rather than using variadic arguments. This
makes it much easier to use OF_call_method() when the format of the
arguments passed to a given method are determined at run-time
(due to e.g. #address-cells).
- Properly inform OpenFirmware where the kernel is loaded by using
"claim" on /chosen/memory and, if running in virtual-mode, using
"claim" on /chosen/mmu to reserve the VA, and "map" on /chosen/mmu
to enter the translation. (The kernel is still always mapped VA==PA.)
 1.34 15-Apr-2020  rin branches: 1.34.2;
When boot up with auto-boot? == true, some systems do not provide stdout
if the normal output is screen.

Open screen explicitly as stdout in this case, both for ofwboot and kernel,
which fixes problems with auto-boot? == true for Mac mini G4:

- messages from ofwboot do not appear
- kernel freeze during early boot stage

Taken from OpenBSD:
http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sys/arch/macppc/macppc/ofw_machdep.c#rev1.3
http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sys/arch/macppc/stand/Locore.c#rev1.3

XXX
pullup to netbsd-9 and -8
 1.33 12-Nov-2018  scole branches: 1.33.4; 1.33.10;
PR 51495/port-macppc

Allow ppc601 to boot off hard disk
 1.32 17-Aug-2018  macallan - add some G5-specific setup
- OF_claim() more heap space on G5
With this, and -DHEAP_VARIABLE my G5s boot from harddisk
 1.31 06-Jun-2018  uwe branches: 1.31.2;
Provide commented out OF_enter() that comes in handy when debugging.
 1.30 06-Jun-2018  uwe Provide an option to use libsa allocator. Not yet enabled. Same
binary code is generated.

To enable uncomment -DHEAP_VARIABLE and comment out alloc.c in the
makefile.

PR port-macppc/44895
 1.29 22-Apr-2016  christos branches: 1.29.10; 1.29.16;
undo unintended commit
 1.28 22-Apr-2016  christos Elide unused variable warnings (Felix Deichmann)
 1.27 13-Mar-2016  tsutsui TAB/space cleanup.
 1.26 26-Jul-2015  tsutsui Don't set garbages into BAT registers, which was broken in rev 1.25.

Should fix PR port-macppc/50018 (though there is no response for 3 weeks),
and should be pulled up to netbsd-7.
 1.25 26-Feb-2014  macallan branches: 1.25.4; 1.25.6;
support 601, from scole_mail
 1.24 17-Jul-2011  joerg branches: 1.24.2; 1.24.12; 1.24.16;
Retire varargs.h support. Move machine/stdarg.h logic into MI
sys/stdarg.h and expect compiler to provide proper builtins, defaulting
to the GCC interface. lint still has a special fallback.
Reduce abuse of _BSD_VA_LIST_ by defining __va_list by default and
derive va_list as required by standards.
 1.23 18-Sep-2006  sanjayl Undo my half hearted atttempt at porting ofwboot to the G5.
Thanks to Cherry for pointing this out, and my apologies.
 1.22 05-Aug-2006  sanjayl branches: 1.22.2; 1.22.4; 1.22.6;
1st cut of Powermac G5 support (uses bridge mode).
 1.21 27-Jan-2006  uwe branches: 1.21.2; 1.21.6;
More constification.
 1.20 27-Jan-2006  uwe Tell gcc that startup and stack are used.
In startup remove declarations of unused symbols.
This file now compiles with WARNS=4.
 1.19 27-Jan-2006  uwe Make -Wcast-qual happy.
 1.18 24-Dec-2005  perry branches: 1.18.2;
bare asm -> __asm
 1.17 11-Dec-2005  christos merge ktrace-lwp.
 1.16 17-Mar-2004  wrstuden branches: 1.16.16;
Have Locore zero out the bss (which includes our stack) BEFORE
we start calling into C code. Previously we called memset() in our
C code. Unfortunately the compiler would sometimes store local variables
on the statck, which got killed by the memset(). Oops!
 1.15 26-Dec-2003  aymeric ANSIfy and clean up prototypes.
This has been lying around in my tree for too long now.
 1.14 02-Apr-2003  thorpej branches: 1.14.2;
Oops, didn't mean to commit this.
 1.13 02-Apr-2003  thorpej Use PAGE_SIZE rather than NBPG.
 1.12 31-Oct-2002  matt Convert to register prefixes. Use ANSI string concatenation for
multiline asm strings.
 1.11 27-Sep-2002  wrstuden Remove vestiges of the syncicache() call originally in powerpc/ofwboot
before rev 1.4. This change makes OF 2.4 machines actually boot, and
it works fine on my OF 2.01 machine. No reports of failures on other
archs.

I expect this change is fine as the original code flushed the just-loaded
ofwboot out of the cache, conditionalized on FIRMWORKSBUGS. In rev.
1.4, the code got in-lined, and changed to actually flush low memory
out of the cache. Since machines kept booting, I expect the firmware
was really flushing the binary out of the cache, so we're fine.
 1.10 29-Mar-2002  tsutsui branches: 1.10.4;
Cosmetics.
 1.9 24-Sep-2001  wiz branches: 1.9.4;
va_{start,end} audit:
Make sure that each va_start has one and only one matching va_end,
especially in error cases.
If the va_list is used multiple times, do multiple va_starts/va_ends.
If a function gets va_list as argument, don't let it use va_end (since
it's the callers responsibility).

Improved by comments from enami and christos -- thanks!

Heimdal/krb4/KAME changes already fed back, rest to follow.

Inspired by, but not not based on, OpenBSD.
 1.8 22-Jul-2001  wiz branches: 1.8.2;
bcopy -> memcpy, bzero -> memset, bcmp -> memcmp.
Reviewed by Matt Thomas, ok'd by Tsubai Masanari.
 1.7 20-Aug-2000  tsubai branches: 1.7.4;
Increase stack size.
 1.6 22-Dec-1999  thorpej Update some comments.
 1.5 04-Feb-1999  tsubai branches: 1.5.8;
Allocate DMA-aware memory area using "dma-alloc" method and use them
for data buffer.
XXX currently only netif_put() uses this.

iMac can use ofwboot.elf now.
 1.4 02-Feb-1999  tsubai Ensure lowest 256MB is mapped by BAT0.
 1.3 24-Jul-1998  tsubai Comment out "insert root disk..." message.
Remove unnecessary video init.
 1.2 26-Jun-1998  tsubai Change load address of ofwboot for large (md root) kernel.
 1.1 15-May-1998  tsubai Initial import of macppc port.
 1.5.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.7.4.4 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.7.4.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.7.4.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.7.4.1 03-Aug-2001  lukem update to -current
 1.8.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.9.4.4 11-Nov-2002  nathanw Catch up to -current
 1.9.4.3 18-Oct-2002  nathanw Catch up to -current.
 1.9.4.2 17-Apr-2002  nathanw Catch up to -current.
 1.9.4.1 24-Sep-2001  nathanw file Locore.c was added on branch nathanw_sa on 2002-04-17 00:03:44 +0000
 1.10.4.1 30-Sep-2002  lukem Pull up revision 1.11 (requested by wrstuden in ticket #867):
Remove vestiges of the syncicache() call originally in powerpc/ofwboot
before rev 1.4. This change makes OF 2.4 machines actually boot, and
it works fine on my OF 2.01 machine. No reports of failures on other
archs.
I expect this change is fine as the original code flushed the just-loaded
ofwboot out of the cache, conditionalized on FIRMWORKSBUGS. In rev.
1.4, the code got in-lined, and changed to actually flush low memory
out of the cache. Since machines kept booting, I expect the firmware
was really flushing the binary out of the cache, so we're fine.
 1.14.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.14.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.14.2.1 03-Aug-2004  skrll Sync with HEAD
 1.16.16.1 21-Jun-2006  yamt sync with head.
 1.18.2.1 01-Feb-2006  yamt sync with head.
 1.21.6.1 11-Aug-2006  yamt sync with head
 1.21.2.1 09-Sep-2006  rpaulo sync with head
 1.22.6.1 22-Oct-2006  yamt sync with head
 1.22.4.1 18-Nov-2006  ad Sync with head.
 1.22.2.1 23-Sep-2006  snj Pull up following revision(s) (requested by sanjayl in ticket #175):
sys/arch/macppc/stand/ofwboot/Locore.c: revision 1.23
Undo my half hearted atttempt at porting ofwboot to the G5.
Thanks to Cherry for pointing this out, and my apologies.
 1.24.16.1 18-May-2014  rmind sync with head
 1.24.12.2 03-Dec-2017  jdolecek update from HEAD
 1.24.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.24.2.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.25.6.2 19-Mar-2016  skrll Sync with HEAD
 1.25.6.1 22-Sep-2015  skrll Sync with HEAD
 1.25.4.1 30-Jul-2015  martin Pull up following revision(s) (requested by tsutsui in ticket #893):
sys/arch/macppc/stand/ofwboot/Locore.c: revision 1.26
Don't set garbages into BAT registers, which was broken in rev 1.25.
Should fix PR port-macppc/50018 (though there is no response for 3 weeks),
and should be pulled up to netbsd-7.
 1.29.16.3 26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts
 1.29.16.2 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.29.16.1 25-Jun-2018  pgoyette Sync with HEAD
 1.29.10.1 21-Apr-2020  martin Pull up following revision(s) (requested by rin in ticket #1533):

sys/arch/macppc/stand/ofwboot/Locore.c: revision 1.34 (via patch)
sys/arch/powerpc/oea/ofw_consinit.c: revision 1.18

When boot up with auto-boot? == true, some systems do not provide stdout
if the normal output is screen.

Open screen explicitly as stdout in this case, both for ofwboot and kernel,
which fixes problems with auto-boot? == true for Mac mini G4:
- messages from ofwboot do not appear
- kernel freeze during early boot stage

Taken from OpenBSD:
http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sys/arch/macppc/macppc/ofw_machdep.c#rev1.3
http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sys/arch/macppc/stand/Locore.c#rev1.3

XXX
pullup to netbsd-9 and -8
 1.31.2.2 21-Apr-2020  martin Sync with HEAD
 1.31.2.1 10-Jun-2019  christos Sync with HEAD
 1.33.10.1 20-Apr-2020  bouyer Sync with HEAD
 1.33.4.1 21-Apr-2020  martin Pull up following revision(s) (requested by rin in ticket #837):

sys/arch/macppc/stand/ofwboot/Locore.c: revision 1.34
sys/arch/powerpc/oea/ofw_consinit.c: revision 1.18

When boot up with auto-boot? == true, some systems do not provide stdout
if the normal output is screen.

Open screen explicitly as stdout in this case, both for ofwboot and kernel,
which fixes problems with auto-boot? == true for Mac mini G4:
- messages from ofwboot do not appear
- kernel freeze during early boot stage

Taken from OpenBSD:
http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sys/arch/macppc/macppc/ofw_machdep.c#rev1.3
http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sys/arch/macppc/stand/Locore.c#rev1.3

XXX
pullup to netbsd-9 and -8
 1.34.2.1 03-Apr-2021  thorpej Sync with HEAD.
 1.62 25-Jul-2025  martin PR 59550: do not build ofwboot as PIE.
While there, disabel all sanitziers too.
 1.61 10-May-2025  martin Strip ofwboot.xcf, pointed out in

https://mail-index.netbsd.org/port-macppc/2024/02/03/msg003076.html

While here avoid modifying the binary in-place to make this more
parallel make safe.
 1.60 28-Feb-2021  thorpej branches: 1.60.24;
- When starting the boot program, cache a bunch of OFW frequently used
ihandles / phandles, rather than fetching them all the time.
- Change the signature of OF_call_method() to take an array of cells for
the inputs and outputs, rather than using variadic arguments. This
makes it much easier to use OF_call_method() when the format of the
arguments passed to a given method are determined at run-time
(due to e.g. #address-cells).
- Properly inform OpenFirmware where the kernel is loaded by using
"claim" on /chosen/memory and, if running in virtual-mode, using
"claim" on /chosen/mmu to reserve the VA, and "map" on /chosen/mmu
to enter the translation. (The kernel is still always mapped VA==PA.)
 1.59 06-Jun-2018  uwe branches: 1.59.14;
Provide an option to use libsa allocator. Not yet enabled. Same
binary code is generated.

To enable uncomment -DHEAP_VARIABLE and comment out alloc.c in the
makefile.

PR port-macppc/44895
 1.58 20-Apr-2017  uwe branches: 1.58.10;
Quash .eh_frame unwind tables in boot code.
 1.57 20-Apr-2017  uwe Group CLEANFILES assignments.
 1.56 08-Apr-2017  christos centralize vers.c building for standalone programs.
 1.55 24-Dec-2014  matt branches: 1.55.2; 1.55.4;
Don't strip the .mrg since the symbols can be useful.
 1.54 10-Aug-2014  joerg branches: 1.54.4;
Put GCC/GAS specific options under ACTIVE_CC == "gcc".
 1.53 08-Aug-2014  joerg Don't set -mmultiple or -mno-string for PowerPC, the difference is too
small to really matter and it sometimes even increases the size.
 1.52 12-Jan-2014  tsutsui branches: 1.52.2;
Add empty LIBCRTI= as LIBCRT0 to build sa programs without installed DESTDIR.

XXX: probabry we should have bsd.saprog.mk or something.
 1.51 22-Jan-2011  joerg branches: 1.51.4; 1.51.14; 1.51.18;
Drop bootprog_maker (formerly enabled by -M) and bootprog_date (formerly
disabled by -D) from the output of newvers_stand.sh. Change -D to the
inverted logic, so that it adds the date to bootprog_rev in ().

Change all platforms accordingly. -D is added if MKREPRO is not yes and
wasn't present before. Platforms that didn't use -D don't depend on
MKREPRO now either.
 1.50 27-May-2010  dholland branches: 1.50.2; 1.50.4;
Introduce .WAIT into the cleandir rule for blasting the libsa/libkern/etc.
trees, because it can race with the libsa/libkern/etc. makefiles' own
cleandir rules. I think I've found all of the uses of the offending idiom...
Closes PR 43360.
 1.49 03-Apr-2009  tsutsui branches: 1.49.2; 1.49.4;
Remove obsolete LIBSA_USE_MEMCPY and LIBSA_USE_MEMSET.
They were removed from <lib/libsa/stand.h> on December 2007.
 1.48 15-Mar-2009  tsutsui Use <bsd.klinks.mk> to create MD include dir symlinks.
 1.47 12-Jan-2009  tsutsui branches: 1.47.2;
WARNSfy
 1.46 22-May-2008  hauke branches: 1.46.6;
Added driver for the Creative Systems Inc. Hurdler CPI parallel printer card.
Timecounter support for the Z8536 counters A + B is not complete, yet.

Reviewed by Martin Husemann.
 1.45 11-Dec-2005  christos branches: 1.45.74; 1.45.76; 1.45.78; 1.45.80;
merge ktrace-lwp.
 1.44 21-Jun-2004  jmc Ignore errors on some rm -rf's for platforms that aren't quite
POSIX compliant
and return errors on r/o source (FreeBSD) for -rf. Fixes PR#25022
 1.43 09-Apr-2004  matt When linking, use ${_MKTARGET_LINK} so that MAKEVERBOSE=1 looks right.
 1.42 12-Mar-2004  wrstuden branches: 1.42.2;
Fix ofwboot to deal with larger kernels. Rather than loading at
0x6?0000, load at 0xe00000. This gives us room for around 13 MB of
kernel, as opposed to the current 5 MB (0x600000 - 0x100000).

No changes to load-base or real-base are needed due to this change,
though machines that needed specific OFW settings before (OF 1.x
and 2.x) this change still need those settings.

Partially revert revision 1.25 -> 1.26 of ofwboot/Makefile & friends.
We do not need to distinguish between where ofwboot and ofwboot.{elf,xcf}
load; they are both fine loading somewhere other than load-base.
 1.41 26-Dec-2003  aymeric revert previous. -fwritable-strings is not needed now that the ld script
does TRT.
 1.40 26-Dec-2003  aymeric add -fwritable-strings to DBG, so that gcc doesn't generate a ".rodata" section.
I believe this fixes PR port-macppc/23206 and the "ofwboot.xcf issues" reported
on the lists since november.
 1.39 11-Dec-2003  matt Convert fixcoff into a true host tool by making it under tools.
 1.38 26-Oct-2003  lukem Use ${HOST_SH} instead of `sh'.

If necessary, pull in <bsd.sys.mk> to get the definition of HOST_SH;
Makefiles that pull in one of (most of) <bsd.*.mk> will get this anyway.
 1.37 28-Feb-2003  matt branches: 1.37.2;
Make this play with gcc 3.3. Add -ffreestanding. Cleanup bootxx.
 1.36 09-Dec-2002  thorpej No need to depend on userland libraries here.
 1.35 20-Sep-2002  wrstuden Re-add own alloc(). Recent issues with kernels randomly dying on boot
are related to using libsa's alloc(). Problems go away with this alloc().

The problem is that the libsa alloc() assumes we can grab memory off
the end of the program. That assumption doesn't work for us. It's
much better to use the alloc() we were using as it calls OF_claim()
to get memory.
 1.34 18-Jun-2002  itojun avoid hardcoding MBR_MAGICOFF and MBR_MAGIC.
 1.33 13-Apr-2002  tsutsui branches: 1.33.2; 1.33.4;
Add "cleanlibdir" target.
 1.32 13-Apr-2002  tsutsui Set USE_LIBSA_MEMCPY and USE_LIBSA_MEMSET to save a few bytes.
 1.31 30-Mar-2002  tsutsui Enable SUPPORT_USTARFS and HAVE_CHANGEDISK_HOOK in CPPFLAGS.
 1.30 29-Mar-2002  tsutsui Add back -I. to CPPFLAGS.
 1.29 29-Mar-2002  tsutsui Cleanup some flags.
 1.28 02-Mar-2002  jmc Wrap the generation of machine and powerpc links so they don't happen during
make obj, clean or cleandir as the proper objdir may not be around yet.
 1.27 13-Feb-2002  wrstuden Make this work with the dependall target.

Pointed out by Christian Groessle on port-macppc, and patch suggested bu
Izumi Tsutsui.
 1.26 01-Feb-2002  wrstuden Check in machinery to make ofwboot load at 600000, while ofwboot.elf
and ofwboot.xcf will load at 640000. The idea is that we can now
leave load-base at 600000, and it will work right for all three methods.

The problem is that the file loader and the net loader use load-base
as a scratch area, so if the executable really wants to load there,
the load fails.
 1.25 07-Jan-2002  matt Remove machine/powerpc links on clean as well.
 1.24 12-Dec-2001  tv MKfoo=no -> NOfoo
 1.23 14-Nov-2001  tv ${MAKE} print-objdir -> ${PRINTOBJDIR}
 1.22 22-Sep-2001  tv branches: 1.22.4;
objcopy -> ${OBJCOPY}; remove redundant definitions of OBJCOPY?= (it is
now in bsd.own.mk).
 1.21 18-Jul-2001  matt branches: 1.21.2;
Add -Wno-main since this is a standalone program.
 1.20 16-Nov-2000  matt branches: 1.20.4;
It's hfs.c, not hfs. Add -I${.CURDIR} for objdirs. XXX hfs.c should
be integrated into libsa.
 1.19 14-Nov-2000  tsubai Add hfs support. Currently this layer simply throw the request to the OF
(and the OF recognizes HFS).
 1.18 28-Oct-2000  garbled make -> ${MAKE}
 1.17 13-Oct-2000  wrstuden Move ofwboot to 600000 hex. Should make loading better (less likely to
run into OF internals).
 1.16 25-Jul-2000  tsubai Use libsa alloc().
 1.15 25-Jul-2000  tsubai Add ofwboot.{mrg,xcf} to CLEANFILES.
 1.14 25-Jul-2000  tsubai Make this compile again.
 1.13 21-Jul-2000  jdolecek switch to sys/conf/newvers_stand.sh for generation of version file
slighly adjust the Makefile WRT vers.c and SRCS & CLEANFILES
 1.12 06-Jul-2000  dmcmahill make sure ofwboot.xcf gets installed
 1.11 08-Jun-2000  matt branches: 1.11.2;
Squeeze a few more bytes so the INSTALL kernel will fit on a floppy.
Use tlp instead of de. Add in gm[ac]. Remove slip and Gallant 22x12 font.
Compile ofwboot.elf -Os.
 1.10 29-Apr-2000  mycroft branches: 1.10.2;
Use DHCP, not BOOTP. At least with dhcpd, the root path gets dropped due to
lack of space in the reply when using BOOTP.
 1.9 07-Feb-2000  tsubai Move CFLAGS and CPPFLAGS to {bootxx,ofwboot}/Makefile to compile installboot
without -D_STANDALONE.
 1.8 23-Jan-2000  mycroft Clean up the machine symlink stuff ever so slightly. Needs to be
standardized between files.
 1.7 23-Nov-1999  wrstuden Now make an ofwboot.xcf, and XCOFF version of ofwboot. Uses the new
fix-coff program.
 1.6 21-Jun-1999  wrstuden branches: 1.6.2; 1.6.8;
Install ofwboot.elf in addition to ofwboot. Thanks to Chris for info on how
to do this!
 1.5 29-Apr-1999  tsubai Use MI loadfile().
 1.4 13-Feb-1999  lukem branches: 1.4.2; 1.4.4;
convert from NOxxx= to MKxxx=no.
include <bsd.own.mk> if testing a MKxxx variable.
 1.3 26-Jun-1998  tsubai Change load address of ofwboot for large (md root) kernel.
 1.2 12-Jun-1998  tsubai Add primary boot (bootxx) and installboot command.
 1.1 15-May-1998  tsubai Initial import of macppc port.
 1.4.4.2 01-Jul-1999  thorpej Sync w/ -current.
 1.4.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.4.2.1 13-Jul-2000  he Apply patch (requested by he):
Enhance the ``make release'' process:
o Build and install the distrib and boot bits
 1.6.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.6.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.6.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.10.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.11.2.6 14-Feb-2002  he Pull up revision 1.27 (requested by wrstuden):
Make this work with the dependall target.
 1.11.2.5 13-Feb-2002  he Pull up revisions 1.14-1.15,1.25 (via patch, requested by wrstuden):
Make it so that we can use load-base 600000 for ofwboot, ofwboot.elf,
and ofwboot.xcf. The fundamental problem is that for ofwboot,
load-base needs to be the load point, while for ofwboot.xcf and
ofwboot.elf, it needs to not be the load point, but rather a
scratch buffer used for loading.
 1.11.2.4 24-Apr-2001  he Pull up revisions 1.19-1.20 (via patch, requested by tsubai):
Add HFS support to the boot loader.
 1.11.2.3 09-Nov-2000  tv Pullup patch [matt]:
Add -mmultiple to COPTS as it is in DBG on the trunk; shrinks ofwboot by 4K.
 1.11.2.2 17-Oct-2000  tv Pullup 1.17 [wrstuden]:
Move ofwboot to 600000 hex. Should make loading better (less likely to
run into OF internals).
 1.11.2.1 03-Aug-2000  dmcmahill Pull up revision 1.12 (requested by dmcmahill, approved by thorpej):
Add ofwboot.xcf to the list of files to be installed.
Fixes PR10418.
 1.20.4.7 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.20.4.6 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.20.4.5 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.20.4.4 16-Mar-2002  jdolecek Catch up with -current.
 1.20.4.3 11-Feb-2002  jdolecek Sync w/ -current.
 1.20.4.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.20.4.1 03-Aug-2001  lukem update to -current
 1.21.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.22.4.9 11-Dec-2002  thorpej Sync with HEAD.
 1.22.4.8 18-Oct-2002  nathanw Catch up to -current.
 1.22.4.7 20-Jun-2002  nathanw Catch up to -current.
 1.22.4.6 17-Apr-2002  nathanw Catch up to -current.
 1.22.4.5 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.22.4.4 28-Feb-2002  nathanw Catch up to -current.
 1.22.4.3 11-Jan-2002  nathanw More catchup.
 1.22.4.2 08-Jan-2002  nathanw Catch up to -current.
 1.22.4.1 22-Sep-2001  nathanw file Makefile was added on branch nathanw_sa on 2002-01-08 00:26:15 +0000
 1.33.4.1 30-Sep-2002  lukem Pull up revision 1.35 (requested by wrstuden in ticket #866):
Re-add own alloc(). Recent issues with kernels randomly dying on boot
are related to using libsa's alloc(). Problems go away with this alloc().
The problem is that the libsa alloc() assumes we can grab memory off
the end of the program. That assumption doesn't work for us. It's
much better to use the alloc() we were using as it calls OF_claim()
to get memory.
 1.33.2.1 16-Jul-2002  gehenna catch up with -current.
 1.37.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.37.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.37.2.1 03-Aug-2004  skrll Sync with HEAD
 1.42.2.1 22-Jun-2004  tron Pull up revision 1.44 (requested by jmc in ticket #531):
Ignore errors on some rm -rf's for platforms that aren't quite
POSIX compliant
and return errors on r/o source (FreeBSD) for -rf. Fixes PR#25022
 1.45.80.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.45.78.2 11-Aug-2010  yamt sync with head.
 1.45.78.1 04-May-2009  yamt sync with head.
 1.45.76.1 04-Jun-2008  yamt sync with head
 1.45.74.2 17-Jan-2009  mjf Sync with HEAD.
 1.45.74.1 02-Jun-2008  mjf Sync with HEAD.
 1.46.6.2 28-Apr-2009  skrll Sync with HEAD.
 1.46.6.1 19-Jan-2009  skrll Sync with HEAD.
 1.47.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.49.4.2 05-Mar-2011  rmind sync with head
 1.49.4.1 30-May-2010  rmind sync with head
 1.49.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.50.4.1 08-Feb-2011  bouyer Sync with HEAD
 1.50.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.51.18.1 18-May-2014  rmind sync with head
 1.51.14.2 03-Dec-2017  jdolecek update from HEAD
 1.51.14.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.51.4.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.52.2.1 10-Aug-2014  tls Rebase.
 1.54.4.2 28-Aug-2017  skrll Sync with HEAD
 1.54.4.1 06-Apr-2015  skrll Sync with HEAD
 1.55.4.1 21-Apr-2017  bouyer Sync with HEAD
 1.55.2.1 26-Apr-2017  pgoyette Sync with HEAD
 1.58.10.1 25-Jun-2018  pgoyette Sync with HEAD
 1.59.14.1 03-Apr-2021  thorpej Sync with HEAD.
 1.60.24.1 02-Aug-2025  perseant Sync with HEAD
 1.3 24-Dec-2005  perry bare asm -> __asm
 1.2 31-Oct-2002  matt branches: 1.2.22;
Convert to register prefixes. Use ANSI string concatenation for
multiline asm strings.
 1.1 23-Nov-1999  wrstuden branches: 1.1.2; 1.1.8; 1.1.16;
Now make an ofwboot.xcf, and XCOFF version of ofwboot. Uses the new
fix-coff program.
 1.1.16.1 11-Nov-2002  nathanw Catch up to -current
 1.1.8.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.1.8.1 23-Nov-1999  bouyer file Xcoffxtra.c was added on branch thorpej_scsipi on 2000-11-20 20:13:04 +0000
 1.1.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.2.22.1 21-Jun-2006  yamt sync with head.
 1.10 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.9 27-Jan-2006  uwe branches: 1.9.72; 1.9.74; 1.9.76;
Move #ifdef __notyet__ inside freeall() to match sparc and ofppc.
 1.8 27-Jan-2006  uwe Pull cleanup fixes from sys/arch/shark/stand/ofwboot/alloc.c.
These files are now almost identical.
 1.7 25-Jan-2006  christos free -> dealloc
unsigned -> size_t for alloc/dealloc
 1.6 11-Dec-2005  christos branches: 1.6.2;
merge ktrace-lwp.
 1.5 26-Dec-2003  aymeric branches: 1.5.16;
ANSIfy and clean up prototypes.
This has been lying around in my tree for too long now.
 1.4 17-Feb-2003  soren branches: 1.4.2;
Make ALLOC_TRACE work again.
 1.3 20-Sep-2002  wrstuden branches: 1.3.2; 1.3.4;
Re-add own alloc(). Recent issues with kernels randomly dying on boot
are related to using libsa's alloc(). Problems go away with this alloc().

The problem is that the libsa alloc() assumes we can grab memory off
the end of the program. That assumption doesn't work for us. It's
much better to use the alloc() we were using as it calls OF_claim()
to get memory.
 1.2 25-Jul-2000  tsubai branches: 1.2.2;
Use libsa alloc().
 1.1 15-May-1998  tsubai branches: 1.1.14;
Initial import of macppc port.
 1.1.14.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.2.2.1 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.3.4.2 18-Oct-2002  nathanw Catch up to -current.
 1.3.4.1 20-Sep-2002  nathanw file alloc.c was added on branch nathanw_sa on 2002-10-18 02:38:41 +0000
 1.3.2.2 30-Sep-2002  lukem Pull up revision 1.3 (requested by wrstuden in ticket #866):
Re-add own alloc(). Recent issues with kernels randomly dying on boot
are related to using libsa's alloc(). Problems go away with this alloc().
The problem is that the libsa alloc() assumes we can grab memory off
the end of the program. That assumption doesn't work for us. It's
much better to use the alloc() we were using as it calls OF_claim()
to get memory.
 1.3.2.1 20-Sep-2002  lukem file alloc.c was added on branch netbsd-1-6 on 2002-09-30 13:38:33 +0000
 1.4.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.4.2.1 03-Aug-2004  skrll Sync with HEAD
 1.5.16.1 21-Jun-2006  yamt sync with head.
 1.6.2.1 01-Feb-2006  yamt sync with head.
 1.9.76.1 16-May-2008  yamt sync with head.
 1.9.74.1 18-May-2008  yamt sync with head.
 1.9.72.1 02-Jun-2008  mjf Sync with HEAD.
 1.32 13-Jan-2025  tsutsui Tweak bootpath strings in ofwboot for OpenBIOS used on qemu-system-ppc.

Bump version to denote the visible change.

This makes qemu-system-ppc -M mac99 booting from a harddisk image
using ofwboot installed by installboot(8) with /usr/mdec/bootxx:
---
% qemu-system-ppc --version
QEMU emulator version 9.1.2
Copyright (c) 2003-2024 Fabrice Bellard and the QEMU Project developers
% qemu-system-ppc -M mac99 -drive file=NetBSD-10.1-macppc.img,media=disk,format=raw -nographic

>> =============================================================
>> OpenBIOS 1.1 [Mar 7 2023 22:21]
>> Configuration device id QEMU version 1 machine id 1
>> CPUs: 1
>> Memory: 128M
>> UUID: 00000000-0000-0000-0000-000000000000
>> CPU type PowerPC,G4
milliseconds isn't unique.
Welcome to OpenBIOS v1.1 built on Mar 7 2023 22:21
Trying hd:,\\:tbxi...
Trying hd:,\ppc\bootinfo.txt...
Trying hd:,%BOOT...
>> Not a bootable ELF image
>> switching to new context:

OF_open bootpath=/pci@f2000000/mac-io@c/ata-3@20000/disk@0
read stage 2 blocks: 01234. done!
starting stage 2...

>> NetBSD/macppc OpenFirmware Boot, Revision 1.14 (Mon Jan 13 14:50:50 UTC 2025)
>> Open Firmware version 3.x
>> Open Firmware running in virtual-mode.
prom2boot: bootpath from OF: "/pci@f2000000/mac-io@c/ata-3@20000/disk@0:,%BOOT"
prom2boot: bootpath patched: "/pci@f2000000/mac-io@c/ata-3@20000/disk@0:"
bootline=
Trying /netbsd
11860332+167196 [463456+447084]=0xc570ec
start=0x100000
[ 1.0000000] Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
[ 1.0000000] 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013,
[ 1.0000000] 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023,
[ 1.0000000] 2024
[ 1.0000000] The NetBSD Foundation, Inc. All rights reserved.
[ 1.0000000] Copyright (c) 1982, 1986, 1989, 1991, 1993
[ 1.0000000] The Regents of the University of California. All rights reserved.

[ 1.0000000] NetBSD 10.1 (GENERIC) #0: Mon Dec 16 13:08:11 UTC 2024
[ 1.0000000] mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/macppc/compile/GENERIC
---
 1.31 28-Feb-2021  thorpej branches: 1.31.18; 1.31.24;
- When starting the boot program, cache a bunch of OFW frequently used
ihandles / phandles, rather than fetching them all the time.
- Change the signature of OF_call_method() to take an array of cells for
the inputs and outputs, rather than using variadic arguments. This
makes it much easier to use OF_call_method() when the format of the
arguments passed to a given method are determined at run-time
(due to e.g. #address-cells).
- Properly inform OpenFirmware where the kernel is loaded by using
"claim" on /chosen/memory and, if running in virtual-mode, using
"claim" on /chosen/mmu to reserve the VA, and "map" on /chosen/mmu
to enter the translation. (The kernel is still always mapped VA==PA.)
 1.30 23-Apr-2020  joerg branches: 1.30.2;
bootfile is owned by libsa
 1.29 06-Jun-2018  uwe branches: 1.29.12;
Provide an option to use libsa allocator. Not yet enabled. Same
binary code is generated.

To enable uncomment -DHEAP_VARIABLE and comment out alloc.c in the
makefile.

PR port-macppc/44895
 1.28 11-Jun-2016  dholland branches: 1.28.16;
PR 51200 gets in libsa considered harmful: use kgets
 1.27 19-Feb-2012  tsutsui branches: 1.27.2; 1.27.16;
Fix boot failure on OF 2.0 machines.

Discussed with phx@ on port-macppc@:
http://mail-index.NetBSD.org/port-macppc/2012/02/18/msg001556.html

Should be pulled up to netbsd-6.
 1.26 22-Jan-2011  joerg branches: 1.26.4; 1.26.8; 1.26.10;
Drop bootprog_maker (formerly enabled by -M) and bootprog_date (formerly
disabled by -D) from the output of newvers_stand.sh. Change -D to the
inverted logic, so that it adds the date to bootprog_rev in ().

Change all platforms accordingly. -D is added if MKREPRO is not yes and
wasn't present before. Platforms that didn't use -D don't depend on
MKREPRO now either.
 1.25 25-Aug-2010  christos branches: 1.25.2; 1.25.4;
s/LOAD_NOTE/LOAD_BACKWARDS/
 1.24 29-Mar-2010  mrg avoid some warnings on powerpc64.
 1.23 28-Jan-2009  tsutsui branches: 1.23.4; 1.23.6;
- modify a pathname parse function to explicitly return devname and filename
- check floppyboot properly per devname before loadfile(), not in devopen()
- disable LOAD_NOTE on floppyboot to avoid backward seek
- bump revision

Tested floppy boot and IDE boot on Apus2000 with OpenFirmware 2.0.

Fixes PR install/38943 on macppc.
 1.22 28-Apr-2008  martin branches: 1.22.8; 1.22.10;
Remove clause 3 and 4 from TNF licenses
 1.21 27-Jan-2006  uwe branches: 1.21.72; 1.21.74; 1.21.76;
Call freeall() from chain() to match the code for other ofw platforms.
freeall() is a no-op.
 1.20 27-Jan-2006  uwe Make WARNS=4 happy.
 1.19 11-Dec-2005  christos branches: 1.19.2;
merge ktrace-lwp.
 1.18 31-May-2004  schmonz branches: 1.18.12;
Support userconf(4) ("boot -c"). Reviewed by Bill Studenmund.
 1.17 26-Dec-2003  aymeric branches: 1.17.2;
ANSIfy and clean up prototypes.
This has been lying around in my tree for too long now.
 1.16 30-Mar-2002  tsutsui branches: 1.16.10;
Add changedisk_hook() for ustarfs. (from tsubai)
 1.15 29-Mar-2002  tsutsui Remove unused define/include/variable.
 1.14 29-Mar-2002  tsutsui Cosmetics.
 1.13 23-Aug-2001  tsubai branches: 1.13.6;
Fix a bug introduced when machine_type.h was removed.
Now the kernel can read symbol table again.
 1.12 13-Aug-2001  tsubai Search "/netbsd.gz" and "/netbsd.macppc" in addition to "/netbsd".
 1.11 22-Jul-2001  wiz bcopy -> memcpy, bzero -> memset, bcmp -> memcmp.
Reviewed by Matt Thomas, ok'd by Tsubai Masanari.
 1.10 03-May-2001  soren branches: 1.10.2;
PPC machine type tags haven't been used for a while.
 1.9 24-Sep-2000  jdolecek branches: 1.9.2;
add new macro BOOT_FLAG() (defined in <sys/boot_flag.h>) - this
maps standard boot flags to corresponding RB_* values
use BOOT_FLAG() in port's MD code as appropriate

as discussed on tech-kern, add new boot flags -v, -q for booting
verbosely or quietly, and corresponding AB_VERBOSE/AB_QUIET
boot flags; also add FreeBSD-compatible bootverbose macro and
NetBSD-specific bootquiet macro

for hpcmips, use new bootverbose instead of it's own hpcmips_verbose

Tested on i386, and to limited extend (compile of affected files) also for
mvme68k, hp300, luna68k, sun3.
 1.8 25-Jul-2000  tsubai Use libsa alloc().
 1.7 03-Aug-1999  tsubai branches: 1.7.2;
Make ``boot kernelname'' work on OF-3.x too.
 1.6 29-Apr-1999  tsubai Use MI loadfile().
 1.5 17-Apr-1999  ws Modify syncicache on PowerPC from an inline to a real function.
Support different cache line sizes with the same object code in userland.
While here, move the function to implementation name space.
 1.4 05-Mar-1999  tsubai branches: 1.4.4;
Modify parseargs() so that device names can contain '-'.
 1.3 24-Jul-1998  tsubai Comment out "insert root disk..." message.
Remove unnecessary video init.
 1.2 13-Jul-1998  tsubai Use "boot-device" if "bootpath" is not set.
 1.1 15-May-1998  tsubai Initial import of macppc port.
 1.4.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.7.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.9.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.10.2.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.10.2.2 25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.10.2.1 03-Aug-2001  lukem update to -current
 1.13.6.2 17-Apr-2002  nathanw Catch up to -current.
 1.13.6.1 23-Aug-2001  nathanw file boot.c was added on branch nathanw_sa on 2002-04-17 00:03:44 +0000
 1.16.10.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.16.10.2 18-Sep-2004  skrll Sync with HEAD.
 1.16.10.1 03-Aug-2004  skrll Sync with HEAD
 1.17.2.1 01-Jun-2004  jmc Pullup rev 1.18 (requested by schmonz in ticket #428)

Support userconf(4) ("boot -c").
 1.18.12.1 21-Jun-2006  yamt sync with head.
 1.19.2.1 01-Feb-2006  yamt sync with head.
 1.21.76.4 09-Oct-2010  yamt sync with head
 1.21.76.3 11-Aug-2010  yamt sync with head.
 1.21.76.2 04-May-2009  yamt sync with head.
 1.21.76.1 16-May-2008  yamt sync with head.
 1.21.74.1 18-May-2008  yamt sync with head.
 1.21.72.1 02-Jun-2008  mjf Sync with HEAD.
 1.22.10.1 02-Feb-2009  snj Pull up following revision(s) (requested by tsutsui in ticket #407):
sys/arch/macppc/stand/ofwboot/boot.c: revision 1.23
sys/arch/macppc/stand/ofwboot/boot.h: revision 1.3
sys/arch/macppc/stand/ofwboot/ofdev.c: revision 1.22
sys/arch/macppc/stand/ofwboot/ofdev.h: revision 1.6
sys/arch/macppc/stand/ofwboot/version: revision 1.12
- modify a pathname parse function to explicitly return devname and filename
- check floppyboot properly per devname before loadfile(), not in devopen()
- disable LOAD_NOTE on floppyboot to avoid backward seek
- bump revision
Tested floppy boot and IDE boot on Apus2000 with OpenFirmware 2.0.
Fixes PR install/38943 on macppc.
 1.22.8.1 03-Mar-2009  skrll Sync with HEAD.
 1.23.6.2 05-Mar-2011  rmind sync with head
 1.23.6.1 30-May-2010  rmind sync with head
 1.23.4.2 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.23.4.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.25.4.1 08-Feb-2011  bouyer Sync with HEAD
 1.25.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.26.10.1 22-Feb-2012  riz Pull up following revision(s) (requested by tsutsui in ticket #22):
sys/arch/macppc/stand/ofwboot/boot.c: revision 1.27
sys/arch/macppc/stand/ofwboot/boot.h: revision 1.4
sys/arch/macppc/stand/ofwboot/ofdev.c: revision 1.26
Fix boot failure on OF 2.0 machines.
Discussed with phx@ on port-macppc@:
http://mail-index.NetBSD.org/port-macppc/2012/02/18/msg001556.html
Should be pulled up to netbsd-6.
 1.26.8.1 24-Feb-2012  mrg sync to -current.
 1.26.4.1 17-Apr-2012  yamt sync with head
 1.27.16.1 09-Jul-2016  skrll Sync with HEAD
 1.27.2.1 03-Dec-2017  jdolecek update from HEAD
 1.28.16.1 25-Jun-2018  pgoyette Sync with HEAD
 1.29.12.1 25-Apr-2020  bouyer Sync with bouyer-xenpvh-base2 (HEAD)
 1.30.2.1 03-Apr-2021  thorpej Sync with HEAD.
 1.31.24.1 02-Aug-2025  perseant Sync with HEAD
 1.31.18.1 20-Feb-2025  martin Pull up following revision(s) (requested by tsutsui in ticket #1048):

sys/arch/macppc/stand/ofwboot/version: revision 1.16
sys/arch/macppc/stand/ofwboot/boot.c: revision 1.32

Tweak bootpath strings in ofwboot for OpenBIOS used on qemu-system-ppc.
Bump version to denote the visible change.

This makes qemu-system-ppc -M mac99 booting from a harddisk image
using ofwboot installed by installboot(8) with /usr/mdec/bootxx:
---
% qemu-system-ppc --version
QEMU emulator version 9.1.2
Copyright (c) 2003-2024 Fabrice Bellard and the QEMU Project developers
% qemu-system-ppc -M mac99 -drive file=NetBSD-10.1-macppc.img,media=disk,format=raw -nographic
> =============================================================
> OpenBIOS 1.1 [Mar 7 2023 22:21]
> Configuration device id QEMU version 1 machine id 1
> CPUs: 1
> Memory: 128M
> UUID: 00000000-0000-0000-0000-000000000000
> CPU type PowerPC,G4
milliseconds isn't unique.
Welcome to OpenBIOS v1.1 built on Mar 7 2023 22:21
Trying hd:,\\:tbxi...
Trying hd:,\ppc\bootinfo.txt...
Trying hd:,%BOOT...
> Not a bootable ELF image
> switching to new context:
OF_open bootpath=/pci@f2000000/mac-io@c/ata-3@20000/disk@0
read stage 2 blocks: 01234. done!
starting stage 2...
> NetBSD/macppc OpenFirmware Boot, Revision 1.14 (Mon Jan 13 14:50:50 UTC 2025)
> Open Firmware version 3.x
> Open Firmware running in virtual-mode.
prom2boot: bootpath from OF: "/pci@f2000000/mac-io@c/ata-3@20000/disk@0:,%BOOT"
prom2boot: bootpath patched: "/pci@f2000000/mac-io@c/ata-3@20000/disk@0:"
bootline=
Trying /netbsd
11860332+167196 [463456+447084]=0xc570ec
start=0x100000
[ 1.0000000] Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
[ 1.0000000] 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013,
[ 1.0000000] 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023,
[ 1.0000000] 2024
[ 1.0000000] The NetBSD Foundation, Inc. All rights reserved.
[ 1.0000000] Copyright (c) 1982, 1986, 1989, 1991, 1993
[ 1.0000000] The Regents of the University of California. All rights reserved.
[ 1.0000000] NetBSD 10.1 (GENERIC) #0: Mon Dec 16 13:08:11 UTC 2024
[ 1.0000000] mkrepro%mkrepro.NetBSD.org@localhost:/usr/src/sys/arch/macppc/compile/GENERIC
---
 1.5 09-Jan-2015  matt Force main into .text
 1.4 19-Feb-2012  tsutsui branches: 1.4.2; 1.4.14; 1.4.16;
Fix boot failure on OF 2.0 machines.

Discussed with phx@ on port-macppc@:
http://mail-index.NetBSD.org/port-macppc/2012/02/18/msg001556.html

Should be pulled up to netbsd-6.
 1.3 28-Jan-2009  tsutsui branches: 1.3.14; 1.3.18; 1.3.20;
- modify a pathname parse function to explicitly return devname and filename
- check floppyboot properly per devname before loadfile(), not in devopen()
- disable LOAD_NOTE on floppyboot to avoid backward seek
- bump revision

Tested floppy boot and IDE boot on Apus2000 with OpenFirmware 2.0.

Fixes PR install/38943 on macppc.
 1.2 12-Jan-2009  tsutsui WARNSfy
 1.1 26-Dec-2003  aymeric branches: 1.1.4; 1.1.104; 1.1.108; 1.1.116; 1.1.118;
ANSIfy and clean up prototypes.
This has been lying around in my tree for too long now.
 1.1.118.1 02-Feb-2009  snj Pull up following revision(s) (requested by tsutsui in ticket #407):
sys/arch/macppc/stand/ofwboot/boot.c: revision 1.23
sys/arch/macppc/stand/ofwboot/boot.h: revision 1.3
sys/arch/macppc/stand/ofwboot/ofdev.c: revision 1.22
sys/arch/macppc/stand/ofwboot/ofdev.h: revision 1.6
sys/arch/macppc/stand/ofwboot/version: revision 1.12
- modify a pathname parse function to explicitly return devname and filename
- check floppyboot properly per devname before loadfile(), not in devopen()
- disable LOAD_NOTE on floppyboot to avoid backward seek
- bump revision
Tested floppy boot and IDE boot on Apus2000 with OpenFirmware 2.0.
Fixes PR install/38943 on macppc.
 1.1.116.2 03-Mar-2009  skrll Sync with HEAD.
 1.1.116.1 19-Jan-2009  skrll Sync with HEAD.
 1.1.108.1 04-May-2009  yamt sync with head.
 1.1.104.1 17-Jan-2009  mjf Sync with HEAD.
 1.1.4.2 03-Aug-2004  skrll Sync with HEAD
 1.1.4.1 26-Dec-2003  skrll file boot.h was added on branch ktrace-lwp on 2004-08-03 10:37:31 +0000
 1.3.20.1 22-Feb-2012  riz Pull up following revision(s) (requested by tsutsui in ticket #22):
sys/arch/macppc/stand/ofwboot/boot.c: revision 1.27
sys/arch/macppc/stand/ofwboot/boot.h: revision 1.4
sys/arch/macppc/stand/ofwboot/ofdev.c: revision 1.26
Fix boot failure on OF 2.0 machines.
Discussed with phx@ on port-macppc@:
http://mail-index.NetBSD.org/port-macppc/2012/02/18/msg001556.html
Should be pulled up to netbsd-6.
 1.3.18.1 24-Feb-2012  mrg sync to -current.
 1.3.14.1 17-Apr-2012  yamt sync with head
 1.4.16.1 06-Apr-2015  skrll Sync with HEAD
 1.4.14.1 11-Jan-2015  martin Pull up following revision(s) (requested by chs in ticket #405):
sys/arch/macppc/stand/ofwboot/boot.h: revision 1.5
Force main into .text
 1.4.2.1 03-Dec-2017  jdolecek update from HEAD
 1.2 12-Mar-2004  wrstuden Fix ofwboot to deal with larger kernels. Rather than loading at
0x6?0000, load at 0xe00000. This gives us room for around 13 MB of
kernel, as opposed to the current 5 MB (0x600000 - 0x100000).

No changes to load-base or real-base are needed due to this change,
though machines that needed specific OFW settings before (OF 1.x
and 2.x) this change still need those settings.

Partially revert revision 1.25 -> 1.26 of ofwboot/Makefile & friends.
We do not need to distinguish between where ofwboot and ofwboot.{elf,xcf}
load; they are both fine loading somewhere other than load-base.
 1.1 01-Feb-2002  wrstuden branches: 1.1.2; 1.1.4; 1.1.6; 1.1.22;
Check in machinery to make ofwboot load at 600000, while ofwboot.elf
and ofwboot.xcf will load at 640000. The idea is that we can now
leave load-base at 600000, and it will work right for all three methods.

The problem is that the file loader and the net loader use load-base
as a scratch area, so if the executable really wants to load there,
the load fails.
 1.1.22.1 03-Aug-2004  skrll Sync with HEAD
 1.1.6.2 28-Feb-2002  nathanw Catch up to -current.
 1.1.6.1 01-Feb-2002  nathanw file boot1.c was added on branch nathanw_sa on 2002-02-28 04:10:41 +0000
 1.1.4.2 13-Feb-2002  he Pull up revision 1.1 (new, requested by wrstuden):
Make it so that we can use load-base 600000 for ofwboot, ofwboot.elf,
and ofwboot.xcf. The fundamental problem is that for ofwboot,
load-base needs to be the load point, while for ofwboot.xcf and
ofwboot.elf, it needs to not be the load point, but rather a
scratch buffer used for loading.
 1.1.4.1 01-Feb-2002  he file boot1.c was added on branch netbsd-1-5 on 2002-02-13 23:11:41 +0000
 1.1.2.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.1.2.1 01-Feb-2002  jdolecek file boot1.c was added on branch kqueue on 2002-02-11 20:08:35 +0000
 1.5 11-Dec-2005  christos merge ktrace-lwp.
 1.4 26-Dec-2003  aymeric ANSIfy and clean up prototypes.
This has been lying around in my tree for too long now.
 1.3 22-Aug-2003  he Adapt to const-ification of first arg of open function in fs_ops.
 1.2 22-Jul-2001  wiz branches: 1.2.6; 1.2.22;
bcopy -> memcpy, bzero -> memset, bcmp -> memcmp.
Reviewed by Matt Thomas, ok'd by Tsubai Masanari.
 1.1 14-Nov-2000  tsubai branches: 1.1.2; 1.1.6; 1.1.8;
Add hfs support. Currently this layer simply throw the request to the OF
(and the OF recognizes HFS).
 1.1.8.1 03-Aug-2001  lukem update to -current
 1.1.6.2 24-Apr-2001  he Pull up revision 1.1 (new, requested by tsubai);
Add HFS support to the boot loader.
 1.1.6.1 14-Nov-2000  he file hfs.c was added on branch netbsd-1-5 on 2001-04-24 22:56:37 +0000
 1.1.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.1.2.1 14-Nov-2000  bouyer file hfs.c was added on branch thorpej_scsipi on 2000-11-22 16:00:42 +0000
 1.2.22.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.22.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.22.1 03-Aug-2004  skrll Sync with HEAD
 1.2.6.2 22-Jul-2001  wiz bcopy -> memcpy, bzero -> memset, bcmp -> memcmp.
Reviewed by Matt Thomas, ok'd by Tsubai Masanari.
 1.2.6.1 22-Jul-2001  wiz file hfs.c was added on branch nathanw_sa on 2001-07-22 11:29:49 +0000
 1.3 11-Dec-2005  christos merge ktrace-lwp.
 1.2 22-Aug-2003  he Adapt to const-ification of first arg of open function in fs_ops.
 1.1 14-Nov-2000  tsubai branches: 1.1.2; 1.1.6; 1.1.28;
Add hfs support. Currently this layer simply throw the request to the OF
(and the OF recognizes HFS).
 1.1.28.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.28.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.28.1 03-Aug-2004  skrll Sync with HEAD
 1.1.6.2 24-Apr-2001  he Pull up revision 1.1 (new, requested by tsubai);
Add HFS support to the boot loader.
 1.1.6.1 14-Nov-2000  he file hfs.h was added on branch netbsd-1-5 on 2001-04-24 22:56:37 +0000
 1.1.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.1.2.1 14-Nov-2000  bouyer file hfs.h was added on branch thorpej_scsipi on 2000-11-22 16:00:42 +0000
 1.2 10-Jul-2022  thorpej Fix order of hi / lo halves in the ofw_address_cells == 2 case.
 1.1 28-Feb-2021  thorpej branches: 1.1.4;
- When starting the boot program, cache a bunch of OFW frequently used
ihandles / phandles, rather than fetching them all the time.
- Change the signature of OF_call_method() to take an array of cells for
the inputs and outputs, rather than using variadic arguments. This
makes it much easier to use OF_call_method() when the format of the
arguments passed to a given method are determined at run-time
(due to e.g. #address-cells).
- Properly inform OpenFirmware where the kernel is loaded by using
"claim" on /chosen/memory and, if running in virtual-mode, using
"claim" on /chosen/mmu to reserve the VA, and "map" on /chosen/mmu
to enter the translation. (The kernel is still always mapped VA==PA.)
 1.1.4.2 03-Apr-2021  thorpej Sync with HEAD.
 1.1.4.1 28-Feb-2021  thorpej file loadfile_machdep.c was added on branch thorpej-futex on 2021-04-03 22:28:30 +0000
 1.10 12-Apr-2021  mrg remove shadowed (common) declarations of various libsa variables
from various boot programs. for macppc and zaurus, avoid building
with -fcommon any more.
 1.9 23-Apr-2020  joerg branches: 1.9.4;
rootpath is owned by libsa
 1.8 27-Jan-2006  uwe branches: 1.8.174;
Include relevant libsa headers to make WARNS=4 happy.
 1.7 27-Jan-2006  uwe Return 0 from net_close.
 1.6 11-Dec-2005  christos branches: 1.6.2;
merge ktrace-lwp.
 1.5 26-Dec-2003  aymeric branches: 1.5.16;
ANSIfy and clean up prototypes.
This has been lying around in my tree for too long now.
 1.4 13-Mar-2003  drochner branches: 1.4.2;
Remove remaining uses of libsa/netif -- the "netif" structure was only
used to lookup a "struct of_dev", everything else was ballast.
Do it straightforward now and assign the ofdev directly to io_netif.
 1.3 29-Mar-2002  tsutsui Cosmetics.
 1.2 07-May-1999  drochner branches: 1.2.16; 1.2.20;
include <lib/libkern/libkern.h> for intoa()/inet_ntoa()
 1.1 15-May-1998  tsubai branches: 1.1.10;
Initial import of macppc port.
 1.1.10.1 21-Jun-1999  thorpej Sync w/ -current.
 1.2.20.1 17-Apr-2002  nathanw Catch up to -current.
 1.2.16.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.4.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.4.2.1 03-Aug-2004  skrll Sync with HEAD
 1.5.16.1 21-Jun-2006  yamt sync with head.
 1.6.2.1 01-Feb-2006  yamt sync with head.
 1.8.174.1 25-Apr-2020  bouyer Sync with bouyer-xenpvh-base2 (HEAD)
 1.9.4.1 17-Apr-2021  thorpej Sync with HEAD.
 1.1 26-Dec-2003  aymeric branches: 1.1.4;
ANSIfy and clean up prototypes.
This has been lying around in my tree for too long now.
 1.1.4.2 03-Aug-2004  skrll Sync with HEAD
 1.1.4.1 26-Dec-2003  skrll file net.h was added on branch ktrace-lwp on 2004-08-03 10:37:31 +0000
 1.14 28-Jan-2009  tsutsui More WARNSfy in #ifdef NETIF_DEBUG.
 1.13 12-Jan-2009  tsutsui Replace time_t values in libsa sources with the following two types
to avoid unnecessary 64 bit ops which would make binaries larger:

satime_t (currently unsigned int):
numbers in seconds returned by the machine dependent getsecs() function
which are used to measure relative time

saseconds_t (currently int):
numbers in seconds used to specify timeout to network drivers

Per discussion on current-users.
 1.12 12-Jan-2009  tsutsui WARNSfy
 1.11 27-Jan-2006  uwe branches: 1.11.72; 1.11.76; 1.11.84;
Get rid of unused variables.
 1.10 11-Dec-2005  christos branches: 1.10.2;
merge ktrace-lwp.
 1.9 26-Dec-2003  aymeric branches: 1.9.16;
ANSIfy and clean up prototypes.
This has been lying around in my tree for too long now.
 1.8 13-Mar-2003  drochner branches: 1.8.2;
Avoid conflict with sockets[] definition in net.h
and add some typecasts.
Thanks to Juergen Hannken-Illjes for compile-checking.
 1.7 13-Mar-2003  drochner make netif_close() return value void
fix prototype
 1.6 13-Mar-2003  drochner Remove remaining uses of libsa/netif -- the "netif" structure was only
used to lookup a "struct of_dev", everything else was ballast.
Do it straightforward now and assign the ofdev directly to io_netif.
 1.5 29-Mar-2002  tsutsui Cosmetics.
 1.4 22-Jul-2001  wiz branches: 1.4.6;
bcopy -> memcpy, bzero -> memset, bcmp -> memcmp.
Reviewed by Matt Thomas, ok'd by Tsubai Masanari.
 1.3 04-Feb-1999  tsubai branches: 1.3.22;
Allocate DMA-aware memory area using "dma-alloc" method and use them
for data buffer.
XXX currently only netif_put() uses this.

iMac can use ofwboot.elf now.
 1.2 04-Feb-1999  tsubai Use "local-mac-address" property to get MAC address.
 1.1 15-May-1998  tsubai Initial import of macppc port.
 1.3.22.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.3.22.1 03-Aug-2001  lukem update to -current
 1.4.6.2 17-Apr-2002  nathanw Catch up to -current.
 1.4.6.1 22-Jul-2001  nathanw file netif_of.c was added on branch nathanw_sa on 2002-04-17 00:03:44 +0000
 1.8.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.8.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.8.2.1 03-Aug-2004  skrll Sync with HEAD
 1.9.16.1 21-Jun-2006  yamt sync with head.
 1.10.2.1 01-Feb-2006  yamt sync with head.
 1.11.84.2 03-Mar-2009  skrll Sync with HEAD.
 1.11.84.1 19-Jan-2009  skrll Sync with HEAD.
 1.11.76.1 04-May-2009  yamt sync with head.
 1.11.72.1 17-Jan-2009  mjf Sync with HEAD.
 1.2 13-Mar-2003  drochner make netif_close() return value void
fix prototype
 1.1 13-Mar-2003  drochner Remove remaining uses of libsa/netif -- the "netif" structure was only
used to lookup a "struct of_dev", everything else was ballast.
Do it straightforward now and assign the ofdev directly to io_netif.
 1.31 10-Feb-2024  andvar Fix various typos in comments, log messages and documentation.
 1.30 17-Aug-2021  andvar fix multiplei repetitive typos in comments, messages and documentation. mainly because copy paste code big amount of files are affected.
 1.29 24-May-2021  martin PR 56205: make the 64bit build work
 1.28 28-Feb-2021  thorpej branches: 1.28.4; 1.28.6;
- When starting the boot program, cache a bunch of OFW frequently used
ihandles / phandles, rather than fetching them all the time.
- Change the signature of OF_call_method() to take an array of cells for
the inputs and outputs, rather than using variadic arguments. This
makes it much easier to use OF_call_method() when the format of the
arguments passed to a given method are determined at run-time
(due to e.g. #address-cells).
- Properly inform OpenFirmware where the kernel is loaded by using
"claim" on /chosen/memory and, if running in virtual-mode, using
"claim" on /chosen/mmu to reserve the VA, and "map" on /chosen/mmu
to enter the translation. (The kernel is still always mapped VA==PA.)
 1.27 16-Nov-2018  tsutsui branches: 1.27.12;
Fix boot failure from installation floppies. PR port-macppc/53103

Also bump version to denote a visible fix.
Should be pulled up to netbsd-8 and netbsd-7.
 1.26 19-Feb-2012  tsutsui branches: 1.26.14; 1.26.32; 1.26.38; 1.26.40;
Fix boot failure on OF 2.0 machines.

Discussed with phx@ on port-macppc@:
http://mail-index.NetBSD.org/port-macppc/2012/02/18/msg001556.html

Should be pulled up to netbsd-6.
 1.25 01-Feb-2012  matt branches: 1.25.2;
Allow ofwboot to read files from FAT(dosfs).
 1.24 07-Jul-2011  mrg branches: 1.24.2; 1.24.6;
avoid a multi-level cast issue
 1.23 17-Oct-2010  phx Read the Apple Partition Map to find a default root partition, when the
file name contains no OF path. Tested with OF3 (myself) and OF2 (tsutsui).
 1.22 28-Jan-2009  tsutsui branches: 1.22.4; 1.22.6;
- modify a pathname parse function to explicitly return devname and filename
- check floppyboot properly per devname before loadfile(), not in devopen()
- disable LOAD_NOTE on floppyboot to avoid backward seek
- bump revision

Tested floppy boot and IDE boot on Apus2000 with OpenFirmware 2.0.

Fixes PR install/38943 on macppc.
 1.21 12-Jan-2009  tsutsui WARNSfy
 1.20 22-May-2008  hauke branches: 1.20.6; 1.20.8;
Added driver for the Creative Systems Inc. Hurdler CPI parallel printer card.
Timecounter support for the Z8536 counters A + B is not complete, yet.

Reviewed by Martin Husemann.
 1.19 24-May-2006  mrg branches: 1.19.60; 1.19.62; 1.19.64; 1.19.66;
rename the local 'devsw' to of_devsw - devsw is already defined in libsa
as an 'extern' but this one is static.
 1.18 28-Jan-2006  uwe branches: 1.18.2; 1.18.4; 1.18.6; 1.18.12;
Add relevant #include's to get prototypes.
 1.17 27-Jan-2006  uwe Mostly make WARNS=4 happy.
Same object code generated, except for return 0 in devclose.
 1.16 11-Dec-2005  christos branches: 1.16.2;
merge ktrace-lwp.
 1.15 23-Jun-2005  junyoung branches: 1.15.2;
Use FS_OPS() macro.
 1.14 26-Dec-2003  aymeric ANSIfy and clean up prototypes.
This has been lying around in my tree for too long now.
 1.13 08-Oct-2003  lukem Overhaul MBR handling (part 1):

<sys/bootblock.h>:
* Added definitions for the Master Boot Record (MBR) used by
a variety of systems (primarily i386), including the format
of the BIOS Parameter Block (BPB).
This information was cribbed from a variety of sources
including <sys/disklabel_mbr.h> which this is a superset of.

As part of this, some data structure elements and #defines
were renamed to be more "namespace friendly" and consistent
with other bootblocks and MBR documentation.
Update all uses of the old names to the new names.

<sys/disklabel_mbr.h>:
* Deprecated in favor of <sys/bootblock.h> (the latter is more
"host tool" friendly).

amd64 & i386:
* Renamed /usr/mdec/bootxx_dosfs to /usr/mdec/bootxx_msdos, to
be consistent with the naming convention of the msdosfs tools.

* Removed /usr/mdec/bootxx_ufs, as it's equivalent to bootxx_ffsv1
and it's confusing to have two functionally equivalent bootblocks,
especially given that "ufs" has multiple meanings (it could be
a synonym for "ffs", or the group of ffs/lfs/ext2fs file systems).

* Rework pbr.S (the first sector of bootxx_*):
+ Ensure that BPB (bytes 11..89) and the partition table
(bytes 446..509) do not contain code.
+ Add support for booting from FAT partitions if BOOT_FROM_FAT
is defined. (Only set for bootxx_msdos).
+ Remove "dummy" partition 3; if people want to installboot(8)
these to the start of the disk they can use fdisk(8) to
create a real MBR partition table...
+ Compile with TERSE_ERROR so it fits because of the above.
Whilst this is less user friendly, I feel it's important
to have a valid partition table and BPB in the MBR/PBR.

* Renamed /usr/mdec/biosboot to /usr/mdec/boot, to be consistent
with other platforms.

* Enable SUPPORT_DOSFS in /usr/mdec/boot (stage2), so that
we can boot off FAT partitions.

* Crank version of /usr/mdec/boot to 3.1, and fix some of the other
entries in the version file.

installboot(8) (i386):
* Read the existing MBR of the filesystem and retain the BIOS
Parameter Block (BPB) in bytes 11..89 and the MBR partition
table in bytes 446..509. (Previously installboot(8) would
trash those two sections of the MBR.)

mbrlabel(8):
* Use sys/lib/libkern/xlat_mbr_fstype.c instead of homegrown code
to map the MBR partition type to the NetBSD disklabel type.


Test built "make release" for i386, and new bootblocks verified to work
(even off FAT!).
 1.12 11-Jul-2003  aymeric strategy() should really have an ANSI prototype. Otherwise its daddr_t
argument gets passed wrongly.
This should fix a bug reported by Martin J. Laubach on port-macppc, and
was fixed two weeks ago in NetBSD/ofppc.
 1.11 18-Jun-2002  itojun branches: 1.11.6;
avoid hardcoding MBR_MAGICOFF and MBR_MAGIC.
 1.10 17-Jun-2002  itojun LABELSECTOR is redefined to be 0 on macppc, so it is not usable for MBR
disk label offset. use hardcoded "1" for now, i guess we need a new #define
in sys/disklabel_mbr.h. fixes ofwboot to boot kernel off from MBR-formatted
disk.
 1.9 30-Mar-2002  tsutsui branches: 1.9.2;
Add ustarfs ops.
 1.8 29-Mar-2002  tsutsui Cosmetics.
 1.7 13-Aug-2001  tsubai branches: 1.7.6;
Search "/netbsd.gz" and "/netbsd.macppc" in addition to "/netbsd".
 1.6 22-Jul-2001  wiz bcopy -> memcpy, bzero -> memset, bcmp -> memcmp.
Reviewed by Matt Thomas, ok'd by Tsubai Masanari.
 1.5 14-Nov-2000  tsubai branches: 1.5.4;
Add hfs support. Currently this layer simply throw the request to the OF
(and the OF recognizes HFS).
 1.4 05-Mar-1999  tsubai branches: 1.4.8; 1.4.18;
Adapt Open Firmware 3.x. 1.x and 3.x are not bug-compatible...
 1.3 04-Feb-1999  tsubai Allocate DMA-aware memory area using "dma-alloc" method and use them
for data buffer.
XXX currently only netif_put() uses this.

iMac can use ofwboot.elf now.
 1.2 31-Jan-1999  tsubai Adapt disklabel_mbr.h change.
 1.1 15-May-1998  tsubai Initial import of macppc port.
 1.4.18.1 24-Apr-2001  he Pull up revision 1.5 (requested by tsubai):
Add HFS support to the boot loader.
 1.4.8.1 22-Nov-2000  bouyer Sync with HEAD.
 1.5.4.4 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.5.4.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.5.4.2 25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.5.4.1 03-Aug-2001  lukem update to -current
 1.7.6.3 20-Jun-2002  nathanw Catch up to -current.
 1.7.6.2 17-Apr-2002  nathanw Catch up to -current.
 1.7.6.1 13-Aug-2001  nathanw file ofdev.c was added on branch nathanw_sa on 2002-04-17 00:03:45 +0000
 1.9.2.1 16-Jul-2002  gehenna catch up with -current.
 1.11.6.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.11.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.11.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.11.6.1 03-Aug-2004  skrll Sync with HEAD
 1.15.2.1 21-Jun-2006  yamt sync with head.
 1.16.2.1 01-Feb-2006  yamt sync with head.
 1.18.12.1 19-Jun-2006  chap Sync with head.
 1.18.6.1 26-Jun-2006  yamt sync with head.
 1.18.4.1 01-Jun-2006  kardel Sync with head.
 1.18.2.1 09-Sep-2006  rpaulo sync with head
 1.19.66.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.19.64.1 04-May-2009  yamt sync with head.
 1.19.62.1 04-Jun-2008  yamt sync with head
 1.19.60.2 17-Jan-2009  mjf Sync with HEAD.
 1.19.60.1 02-Jun-2008  mjf Sync with HEAD.
 1.20.8.1 02-Feb-2009  snj Pull up following revision(s) (requested by tsutsui in ticket #407):
sys/arch/macppc/stand/ofwboot/boot.c: revision 1.23
sys/arch/macppc/stand/ofwboot/boot.h: revision 1.3
sys/arch/macppc/stand/ofwboot/ofdev.c: revision 1.22
sys/arch/macppc/stand/ofwboot/ofdev.h: revision 1.6
sys/arch/macppc/stand/ofwboot/version: revision 1.12
- modify a pathname parse function to explicitly return devname and filename
- check floppyboot properly per devname before loadfile(), not in devopen()
- disable LOAD_NOTE on floppyboot to avoid backward seek
- bump revision
Tested floppy boot and IDE boot on Apus2000 with OpenFirmware 2.0.
Fixes PR install/38943 on macppc.
 1.20.6.2 03-Mar-2009  skrll Sync with HEAD.
 1.20.6.1 19-Jan-2009  skrll Sync with HEAD.
 1.22.6.1 05-Mar-2011  rmind sync with head
 1.22.4.1 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.24.6.2 24-Feb-2012  mrg sync to -current.
 1.24.6.1 18-Feb-2012  mrg merge to -current.
 1.24.2.1 17-Apr-2012  yamt sync with head
 1.25.2.1 22-Feb-2012  riz Pull up following revision(s) (requested by tsutsui in ticket #22):
sys/arch/macppc/stand/ofwboot/boot.c: revision 1.27
sys/arch/macppc/stand/ofwboot/boot.h: revision 1.4
sys/arch/macppc/stand/ofwboot/ofdev.c: revision 1.26
Fix boot failure on OF 2.0 machines.
Discussed with phx@ on port-macppc@:
http://mail-index.NetBSD.org/port-macppc/2012/02/18/msg001556.html
Should be pulled up to netbsd-6.
 1.26.40.1 10-Jun-2019  christos Sync with HEAD
 1.26.38.1 26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts
 1.26.32.1 18-Nov-2018  martin Pull up following revision(s) (requested by tsutsui in ticket #1097):

sys/arch/macppc/stand/ofwboot/version: revision 1.14
sys/arch/macppc/stand/ofwboot/ofdev.c: revision 1.27

Fix boot failure from installation floppies. PR port-macppc/53727

Also bump version to denote a visible fix.

Should be pulled up to netbsd-8 and netbsd-7.
 1.26.14.1 18-Nov-2018  martin Pull up following revision(s) (requested by tsutsui in ticket #1651):

sys/arch/macppc/stand/ofwboot/version: revision 1.14
sys/arch/macppc/stand/ofwboot/ofdev.c: revision 1.27

Fix boot failure from installation floppies. PR port-macppc/53727

Also bump version to denote a visible fix.

Should be pulled up to netbsd-8 and netbsd-7.
 1.27.12.1 03-Apr-2021  thorpej Sync with HEAD.
 1.28.6.1 31-May-2021  cjep sync with head
 1.28.4.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.6 28-Jan-2009  tsutsui - modify a pathname parse function to explicitly return devname and filename
- check floppyboot properly per devname before loadfile(), not in devopen()
- disable LOAD_NOTE on floppyboot to avoid backward seek
- bump revision

Tested floppy boot and IDE boot on Apus2000 with OpenFirmware 2.0.

Fixes PR install/38943 on macppc.
 1.5 11-Dec-2005  christos branches: 1.5.78; 1.5.86; 1.5.88;
merge ktrace-lwp.
 1.4 26-Dec-2003  aymeric ANSIfy and clean up prototypes.
This has been lying around in my tree for too long now.
 1.3 13-Aug-2001  tsubai branches: 1.3.6; 1.3.22;
Search "/netbsd.gz" and "/netbsd.macppc" in addition to "/netbsd".
 1.2 04-Feb-1999  tsubai branches: 1.2.22;
Allocate DMA-aware memory area using "dma-alloc" method and use them
for data buffer.
XXX currently only netif_put() uses this.

iMac can use ofwboot.elf now.
 1.1 15-May-1998  tsubai Initial import of macppc port.
 1.2.22.1 25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.3.22.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.22.2 18-Sep-2004  skrll Sync with HEAD.
 1.3.22.1 03-Aug-2004  skrll Sync with HEAD
 1.3.6.2 13-Aug-2001  tsubai Search "/netbsd.gz" and "/netbsd.macppc" in addition to "/netbsd".
 1.3.6.1 13-Aug-2001  tsubai file ofdev.h was added on branch nathanw_sa on 2001-08-13 15:38:12 +0000
 1.5.88.1 02-Feb-2009  snj Pull up following revision(s) (requested by tsutsui in ticket #407):
sys/arch/macppc/stand/ofwboot/boot.c: revision 1.23
sys/arch/macppc/stand/ofwboot/boot.h: revision 1.3
sys/arch/macppc/stand/ofwboot/ofdev.c: revision 1.22
sys/arch/macppc/stand/ofwboot/ofdev.h: revision 1.6
sys/arch/macppc/stand/ofwboot/version: revision 1.12
- modify a pathname parse function to explicitly return devname and filename
- check floppyboot properly per devname before loadfile(), not in devopen()
- disable LOAD_NOTE on floppyboot to avoid backward seek
- bump revision
Tested floppy boot and IDE boot on Apus2000 with OpenFirmware 2.0.
Fixes PR install/38943 on macppc.
 1.5.86.1 03-Mar-2009  skrll Sync with HEAD.
 1.5.78.1 04-May-2009  yamt sync with head.
 1.9 28-Feb-2021  thorpej - When starting the boot program, cache a bunch of OFW frequently used
ihandles / phandles, rather than fetching them all the time.
- Change the signature of OF_call_method() to take an array of cells for
the inputs and outputs, rather than using variadic arguments. This
makes it much easier to use OF_call_method() when the format of the
arguments passed to a given method are determined at run-time
(due to e.g. #address-cells).
- Properly inform OpenFirmware where the kernel is loaded by using
"claim" on /chosen/memory and, if running in virtual-mode, using
"claim" on /chosen/mmu to reserve the VA, and "map" on /chosen/mmu
to enter the translation. (The kernel is still always mapped VA==PA.)
 1.8 06-Jun-2018  uwe branches: 1.8.14;
Provide commented out OF_enter() that comes in handy when debugging.
 1.7 24-Dec-2007  perry branches: 1.7.96;
Remove __attribute__((__noreturn__)) from things already marked __dead
Found by the department of redundancy department.
 1.6 27-Jan-2006  uwe branches: 1.6.48; 1.6.58; 1.6.62;
More constification.
 1.5 27-Jan-2006  uwe Make -Wcast-qual happy.
 1.4 11-Dec-2005  christos branches: 1.4.2;
merge ktrace-lwp.
 1.3 26-Dec-2003  aymeric branches: 1.3.16;
ANSIfy and clean up prototypes.
This has been lying around in my tree for too long now.
 1.2 29-Mar-2002  tsutsui branches: 1.2.10;
Cosmetics.
 1.1 15-May-1998  tsubai branches: 1.1.28; 1.1.32;
Initial import of macppc port.
 1.1.32.1 17-Apr-2002  nathanw Catch up to -current.
 1.1.28.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.2.10.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.10.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.10.1 03-Aug-2004  skrll Sync with HEAD
 1.3.16.2 21-Jan-2008  yamt sync with head
 1.3.16.1 21-Jun-2006  yamt sync with head.
 1.4.2.1 01-Feb-2006  yamt sync with head.
 1.6.62.1 02-Jan-2008  bouyer Sync with HEAD
 1.6.58.1 26-Dec-2007  ad Sync with head.
 1.6.48.1 09-Jan-2008  matt sync with HEAD
 1.7.96.1 25-Jun-2018  pgoyette Sync with HEAD
 1.8.14.1 03-Apr-2021  thorpej Sync with HEAD.
 1.16 13-Jan-2025  tsutsui Tweak bootpath strings in ofwboot for OpenBIOS used on qemu-system-ppc.

Bump version to denote the visible change.

This makes qemu-system-ppc -M mac99 booting from a harddisk image
using ofwboot installed by installboot(8) with /usr/mdec/bootxx:
---
% qemu-system-ppc --version
QEMU emulator version 9.1.2
Copyright (c) 2003-2024 Fabrice Bellard and the QEMU Project developers
% qemu-system-ppc -M mac99 -drive file=NetBSD-10.1-macppc.img,media=disk,format=raw -nographic

>> =============================================================
>> OpenBIOS 1.1 [Mar 7 2023 22:21]
>> Configuration device id QEMU version 1 machine id 1
>> CPUs: 1
>> Memory: 128M
>> UUID: 00000000-0000-0000-0000-000000000000
>> CPU type PowerPC,G4
milliseconds isn't unique.
Welcome to OpenBIOS v1.1 built on Mar 7 2023 22:21
Trying hd:,\\:tbxi...
Trying hd:,\ppc\bootinfo.txt...
Trying hd:,%BOOT...
>> Not a bootable ELF image
>> switching to new context:

OF_open bootpath=/pci@f2000000/mac-io@c/ata-3@20000/disk@0
read stage 2 blocks: 01234. done!
starting stage 2...

>> NetBSD/macppc OpenFirmware Boot, Revision 1.14 (Mon Jan 13 14:50:50 UTC 2025)
>> Open Firmware version 3.x
>> Open Firmware running in virtual-mode.
prom2boot: bootpath from OF: "/pci@f2000000/mac-io@c/ata-3@20000/disk@0:,%BOOT"
prom2boot: bootpath patched: "/pci@f2000000/mac-io@c/ata-3@20000/disk@0:"
bootline=
Trying /netbsd
11860332+167196 [463456+447084]=0xc570ec
start=0x100000
[ 1.0000000] Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
[ 1.0000000] 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013,
[ 1.0000000] 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023,
[ 1.0000000] 2024
[ 1.0000000] The NetBSD Foundation, Inc. All rights reserved.
[ 1.0000000] Copyright (c) 1982, 1986, 1989, 1991, 1993
[ 1.0000000] The Regents of the University of California. All rights reserved.

[ 1.0000000] NetBSD 10.1 (GENERIC) #0: Mon Dec 16 13:08:11 UTC 2024
[ 1.0000000] mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/macppc/compile/GENERIC
---
 1.15 28-Feb-2021  thorpej branches: 1.15.18; 1.15.24;
- When starting the boot program, cache a bunch of OFW frequently used
ihandles / phandles, rather than fetching them all the time.
- Change the signature of OF_call_method() to take an array of cells for
the inputs and outputs, rather than using variadic arguments. This
makes it much easier to use OF_call_method() when the format of the
arguments passed to a given method are determined at run-time
(due to e.g. #address-cells).
- Properly inform OpenFirmware where the kernel is loaded by using
"claim" on /chosen/memory and, if running in virtual-mode, using
"claim" on /chosen/mmu to reserve the VA, and "map" on /chosen/mmu
to enter the translation. (The kernel is still always mapped VA==PA.)
 1.14 16-Nov-2018  tsutsui branches: 1.14.12;
Fix boot failure from installation floppies. PR port-macppc/53103

Also bump version to denote a visible fix.
Should be pulled up to netbsd-8 and netbsd-7.
 1.13 17-Oct-2010  phx branches: 1.13.34; 1.13.52; 1.13.58; 1.13.60;
Read the Apple Partition Map to find a default root partition, when the
file name contains no OF path. Tested with OF3 (myself) and OF2 (tsutsui).
 1.12 28-Jan-2009  tsutsui branches: 1.12.4; 1.12.6;
- modify a pathname parse function to explicitly return devname and filename
- check floppyboot properly per devname before loadfile(), not in devopen()
- disable LOAD_NOTE on floppyboot to avoid backward seek
- bump revision

Tested floppy boot and IDE boot on Apus2000 with OpenFirmware 2.0.

Fixes PR install/38943 on macppc.
 1.11 11-Dec-2005  christos branches: 1.11.78; 1.11.86; 1.11.88;
merge ktrace-lwp.
 1.10 31-May-2004  schmonz Support userconf(4) ("boot -c"). Reviewed by Bill Studenmund.
 1.9 17-Mar-2004  wrstuden branches: 1.9.2;
Have Locore zero out the bss (which includes our stack) BEFORE
we start calling into C code. Previously we called memset() in our
C code. Unfortunately the compiler would sometimes store local variables
on the statck, which got killed by the memset(). Oops!
 1.8 17-Mar-2004  wrstuden Bump version to help track down issues with kernel loading.
 1.7 18-Oct-2002  wrstuden branches: 1.7.6;
Should have done this sooner. Bump to version 1.7 to indicate good
alloc.c.
 1.6 30-Mar-2002  tsutsui branches: 1.6.4;
Bump version for ustarfs support.
 1.5 09-Nov-2001  scw Bump the version numbers of all bootloaders which use loadfile_elfXX() now
that it tries hard to avoid backwards seeks.
 1.4 02-Aug-2001  bjh21 branches: 1.4.4; 1.4.6;
Bump version numbers of all bootloaders that use loadfile/ELF, to account for
my changes to symbol loading. I should probably have done this at the time,
but it's better late than never.
 1.3 24-Sep-2000  jdolecek branches: 1.3.4;
add new macro BOOT_FLAG() (defined in <sys/boot_flag.h>) - this
maps standard boot flags to corresponding RB_* values
use BOOT_FLAG() in port's MD code as appropriate

as discussed on tech-kern, add new boot flags -v, -q for booting
verbosely or quietly, and corresponding AB_VERBOSE/AB_QUIET
boot flags; also add FreeBSD-compatible bootverbose macro and
NetBSD-specific bootquiet macro

for hpcmips, use new bootverbose instead of it's own hpcmips_verbose

Tested on i386, and to limited extend (compile of affected files) also for
mvme68k, hp300, luna68k, sun3.
 1.2 29-Apr-1999  tsubai branches: 1.2.2;
Use MI loadfile().
 1.1 15-May-1998  tsubai branches: 1.1.10;
Initial import of macppc port.
 1.1.10.1 21-Jun-1999  thorpej Sync w/ -current.
 1.2.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.3.4.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.3.4.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.3.4.1 03-Aug-2001  lukem update to -current
 1.4.6.3 11-Nov-2002  nathanw Catch up to -current
 1.4.6.2 17-Apr-2002  nathanw Catch up to -current.
 1.4.6.1 02-Aug-2001  nathanw file version was added on branch nathanw_sa on 2002-04-17 00:03:45 +0000
 1.4.4.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.6.4.1 21-Oct-2002  lukem Pull up revision 1.7 (requested by wrstuden in ticket #931):
Should have done this sooner. Bump to version 1.7 to indicate good
alloc.c.
 1.7.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.7.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.7.6.1 03-Aug-2004  skrll Sync with HEAD
 1.9.2.1 01-Jun-2004  jmc Pullup rev 1.10 (requested by schmonz in ticket #428)

Support userconf(4) ("boot -c").
 1.11.88.1 02-Feb-2009  snj Pull up following revision(s) (requested by tsutsui in ticket #407):
sys/arch/macppc/stand/ofwboot/boot.c: revision 1.23
sys/arch/macppc/stand/ofwboot/boot.h: revision 1.3
sys/arch/macppc/stand/ofwboot/ofdev.c: revision 1.22
sys/arch/macppc/stand/ofwboot/ofdev.h: revision 1.6
sys/arch/macppc/stand/ofwboot/version: revision 1.12
- modify a pathname parse function to explicitly return devname and filename
- check floppyboot properly per devname before loadfile(), not in devopen()
- disable LOAD_NOTE on floppyboot to avoid backward seek
- bump revision
Tested floppy boot and IDE boot on Apus2000 with OpenFirmware 2.0.
Fixes PR install/38943 on macppc.
 1.11.86.1 03-Mar-2009  skrll Sync with HEAD.
 1.11.78.1 04-May-2009  yamt sync with head.
 1.12.6.1 05-Mar-2011  rmind sync with head
 1.12.4.1 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.13.60.1 10-Jun-2019  christos Sync with HEAD
 1.13.58.1 26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts
 1.13.52.1 18-Nov-2018  martin Pull up following revision(s) (requested by tsutsui in ticket #1097):

sys/arch/macppc/stand/ofwboot/version: revision 1.14
sys/arch/macppc/stand/ofwboot/ofdev.c: revision 1.27

Fix boot failure from installation floppies. PR port-macppc/53727

Also bump version to denote a visible fix.

Should be pulled up to netbsd-8 and netbsd-7.
 1.13.34.1 18-Nov-2018  martin Pull up following revision(s) (requested by tsutsui in ticket #1651):

sys/arch/macppc/stand/ofwboot/version: revision 1.14
sys/arch/macppc/stand/ofwboot/ofdev.c: revision 1.27

Fix boot failure from installation floppies. PR port-macppc/53727

Also bump version to denote a visible fix.

Should be pulled up to netbsd-8 and netbsd-7.
 1.14.12.1 03-Apr-2021  thorpej Sync with HEAD.
 1.15.24.1 02-Aug-2025  perseant Sync with HEAD
 1.15.18.1 20-Feb-2025  martin Pull up following revision(s) (requested by tsutsui in ticket #1048):

sys/arch/macppc/stand/ofwboot/version: revision 1.16
sys/arch/macppc/stand/ofwboot/boot.c: revision 1.32

Tweak bootpath strings in ofwboot for OpenBIOS used on qemu-system-ppc.
Bump version to denote the visible change.

This makes qemu-system-ppc -M mac99 booting from a harddisk image
using ofwboot installed by installboot(8) with /usr/mdec/bootxx:
---
% qemu-system-ppc --version
QEMU emulator version 9.1.2
Copyright (c) 2003-2024 Fabrice Bellard and the QEMU Project developers
% qemu-system-ppc -M mac99 -drive file=NetBSD-10.1-macppc.img,media=disk,format=raw -nographic
> =============================================================
> OpenBIOS 1.1 [Mar 7 2023 22:21]
> Configuration device id QEMU version 1 machine id 1
> CPUs: 1
> Memory: 128M
> UUID: 00000000-0000-0000-0000-000000000000
> CPU type PowerPC,G4
milliseconds isn't unique.
Welcome to OpenBIOS v1.1 built on Mar 7 2023 22:21
Trying hd:,\\:tbxi...
Trying hd:,\ppc\bootinfo.txt...
Trying hd:,%BOOT...
> Not a bootable ELF image
> switching to new context:
OF_open bootpath=/pci@f2000000/mac-io@c/ata-3@20000/disk@0
read stage 2 blocks: 01234. done!
starting stage 2...
> NetBSD/macppc OpenFirmware Boot, Revision 1.14 (Mon Jan 13 14:50:50 UTC 2025)
> Open Firmware version 3.x
> Open Firmware running in virtual-mode.
prom2boot: bootpath from OF: "/pci@f2000000/mac-io@c/ata-3@20000/disk@0:,%BOOT"
prom2boot: bootpath patched: "/pci@f2000000/mac-io@c/ata-3@20000/disk@0:"
bootline=
Trying /netbsd
11860332+167196 [463456+447084]=0xc570ec
start=0x100000
[ 1.0000000] Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
[ 1.0000000] 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013,
[ 1.0000000] 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023,
[ 1.0000000] 2024
[ 1.0000000] The NetBSD Foundation, Inc. All rights reserved.
[ 1.0000000] Copyright (c) 1982, 1986, 1989, 1991, 1993
[ 1.0000000] The Regents of the University of California. All rights reserved.
[ 1.0000000] NetBSD 10.1 (GENERIC) #0: Mon Dec 16 13:08:11 UTC 2024
[ 1.0000000] mkrepro%mkrepro.NetBSD.org@localhost:/usr/src/sys/arch/macppc/compile/GENERIC
---

RSS XML Feed