Home | History | Annotate | only in /src/sys/arch/hp300/stand
History log of /src/sys/arch/hp300/stand
RevisionDateAuthorComments
 1.24 31-May-2000  he Add handling of "make release".
 1.23 04-Feb-1997  thorpej branches: 1.23.20; 1.23.26; 1.23.34;
Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.22 18-Oct-1996  thorpej Use ${INSTALL}.
 1.21 07-Oct-1996  thorpej Sanity sweep.
 1.20 26-Jun-1996  thorpej Major revamp of the boot code.

- Good bye SYS_PBOOT and SYS_NBOOT, hello SYS_UBOOT (unified boot)
Currently supports booting from SCSI and HP-IB disk and network
from a single boot block. Infrastructure for booting from
HP-IB tape is there, but it doesn't quite work yet.

- Add a slightly modified version of Gordon Ross's "rawfs",
which provides a filesystem-like interface to tape devices.
Still needs debugging (see above).

- Rename sys_inst.c to inst.c, so that the LIF directory entry
turns out right (used to look like SYS_SYS_I if loaded from
tape).

- Add a "netio_ask" hint to netio.c, so that a special instnetio.o
doesn't have to be compiled for SYS_INST. Defaults to using
bootparams, but if set, will prompt user for information
usually obtained from bootparams.

- General cleanup.
 1.19 15-Jan-1996  thorpej Use ${BINOWN} and ${BINGRP} per Arne H. Juul <arnej@ikke.idt.unit.no>
in PR #705. Also, clean up some stuff left over from HP-BSD.
 1.18 23-Sep-1995  thorpej Compile the system installation program and install it in /usr/mdec/rbootd
as SYS_INST.
 1.17 02-Sep-1995  thorpej Add support for network booting; uses the following procedure:
rbootd->rarp->bootparam->nfs
Add "reset" option to disk and network boot prompts to reload boot code.
 1.16 04-Aug-1995  thorpej Make the boot blocks compile (and work!) again.
 1.15 21-Feb-1995  mycroft Remove `nboot' completely.
 1.14 19-Feb-1995  mycroft Add unfinished netboot code, and reorganize the Makefile somewhat.
 1.13 26-Oct-1994  cgd new RCS ID format.
 1.12 19-Sep-1994  mycroft Fix misguided attempt to reorganize bootdev, and fix a few
other miscellaneous bugs and nits.
 1.11 15-Aug-1994  mycroft branches: 1.11.2;
Fix `make depend' error.
 1.10 04-Aug-1994  brezak Use installboot.sh from 4.4 instead of installboot.c
 1.9 18-Jul-1994  mycroft Dorothy, I don't think we're in Utah any more...
 1.8 27-Jun-1994  hpeyerl branches: 1.8.2;
Why was DESTDIR= here? From Dave Carrel <carrel@cisco.com
 1.7 19-Jun-1994  hpeyerl hp300/stand stuff from Lite. We can boot hp4xx series nodes now!
 1.6 30-Jan-1994  mycroft Add a missing ${.CURDIR}.
 1.5 26-Jan-1994  cgd .PATH in ${S}/stand
 1.4 26-Jan-1994  brezak hp300 stanealone bootstrap program ported to use CMU libsa
 1.3 31-Jul-1993  mycroft Add RCS indentifiers.
 1.2 22-May-1993  cgd add rcsids to everything and clean up headers
 1.1 13-May-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.1 13-May-1993  cgd add hp300 kernel files. generic kernel files might need some help...
 1.8.2.3 15-Aug-1994  mycroft update from trunk
 1.8.2.2 05-Aug-1994  mycroft update from trunk, per Brezak
 1.8.2.1 18-Jul-1994  cgd updates from trunk
 1.11.2.2 20-Sep-1994  cgd from trunk, per mycroft
 1.11.2.1 15-Aug-1994  cgd file Makefile was added on branch netbsd-1-0 on 1994-09-20 05:07:33 +0000
 1.23.34.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.23.26.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.23.20.1 13-Jul-2000  he Pull up revision 1.24 (requested by he):
Enhance the ``make release'' process:
o Build and install the distrib and boot bits
 1.42 26-May-2025  tsutsui Remove obsolete COMPAT_NOLABEL. It was removed >20 years ago.
 1.41 26-May-2025  tsutsui Also use sti(4) ROM functions for 362/382 framebuffers on bootloader.

Mostly taken on OpenBSD/hp300.
Tested on 382 with VGA-res EVRX, and no visible regression on
425e (sti EVRX), 425t (sti CRX), and 380 (topcat).
 1.40 17-May-2025  tsutsui Speed up hp300 netboot by reducing RTC access during timeout checks.

The read_bbc() function against HIL seems extremely slow.
It was being called on every timeout check via getsecs()
so it significantly slowed down loading a kernel via NFS.

In most cases (e.g., in common/if_le.c and libsa/net.c),
timeout checks are performed using getsecs() in busy loops
without any actual waiting. In such cases, it's not necessary
to read the precise time from the RTC on every call.

This change reduces the time to load the NetBSD/hp300 10.1 GENERIC kernel
via NFS from 260 seconds to 64 seconds on HP9000/382.
 1.39 07-May-2024  tsutsui branches: 1.39.2;
Rename ${PROGAOUT} -> ${PROGELF} to reflect reality.
 1.38 08-Feb-2024  christos PR/57909: Jan-Benedict Glaw: Don't include (build) timestamp when doing a
reproducible build
 1.37 09-Jul-2021  tsutsui branches: 1.37.10;
Specify -fno-unwind-tables to shrink binaries.

Before:
text data bss dec hex filename
77902 4328 137120 219350 358d6 uboot
After:
text data bss dec hex filename
64186 4328 137120 205634 32342 uboot
 1.36 08-Apr-2017  christos branches: 1.36.18; 1.36.30;
centralize vers.c building for standalone programs.
 1.35 17-Jan-2016  tsutsui branches: 1.35.2; 1.35.4;
Enable LIBSA_CREAD_NOCRC. PR/50638

Bump version to denote user visible change.
Tested on HP9000/382.
 1.34 13-Apr-2014  tsutsui branches: 1.34.4;
Add sti(4) at sgc screen console support. From (the late) OpenBSD/hp300.

Tested on HP9000/425e, which was sent from Miod Vallat and
demonstrated at Open Source unConference 2014 Kagawa.
 1.33 12-Jan-2014  tsutsui branches: 1.33.2;
Add empty LIBCRTI= as LIBCRT0 to build sa programs without installed DESTDIR.

XXX: probabry we should have bsd.saprog.mk or something.
 1.32 12-Feb-2011  tsutsui branches: 1.32.4; 1.32.10; 1.32.14; 1.32.18;
Add dumb framebuffer (no acceleration, no colormap) support
for HP362 and HP382.

Tested on A1473-69510 (HP362 VGA-res) and A1474-69511 (HP382 mid-res).
 1.31 10-Feb-2011  tsutsui Pull support for Tigershark monochrome framebuffer from OpenBSD.
Untested (no hardware), but doesn't break existing HP425t topcat.
 1.30 22-Jan-2011  joerg 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.29 03-Apr-2009  tsutsui branches: 1.29.4; 1.29.6; 1.29.8;
Remove obsolete LIBSA_USE_MEMCPY and LIBSA_USE_MEMSET.
They were removed from <lib/libsa/stand.h> on December 2007.
 1.28 15-Mar-2009  tsutsui Use <bsd.klinks.mk> to create symlinks to MD system header directories.
 1.27 16-Jul-2008  tsutsui branches: 1.27.2; 1.27.8;
Change boot messages to replace build date and maker with kernrev.
 1.26 11-Dec-2005  christos branches: 1.26.74; 1.26.78; 1.26.80; 1.26.82; 1.26.84;
merge ktrace-lwp.
 1.25 28-Nov-2004  jmc Convert mkboot into a full cross tool. Last hurdle for hp300 to building on
non NetBSD/bsd hosts.
 1.24 14-Nov-2003  tsutsui branches: 1.24.4;
- define LIBSA_USE_MEMCPY and LIBSA_USE_MEMSET
- set WARNS?=1
 1.23 13-Nov-2003  tsutsui Use 32bit daddr_t for now so that uboot.lif works again.

XXX The real fix is adding prototype declarations for all functions.
 1.22 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.21 02-Oct-2003  simonb Don't depend in libc, et al.
 1.20 30-May-2002  thorpej branches: 1.20.6;
Add -ffreestanding to CFLAGS.
 1.19 16-Mar-2002  gmcgarry branches: 1.19.4; 1.19.6;
Move exec_hp300() out of uboot.c into its own file so that it can
be used by SYS_INST. SYS_INST can now boot ELF kernels inside the
miniroot.
 1.18 12-Dec-2001  tv MKfoo=no -> NOfoo
 1.17 03-Dec-2001  gmcgarry Use BOOTP by default.
 1.16 14-Nov-2001  tv ${MAKE} print-objdir -> ${PRINTOBJDIR}
 1.15 27-May-2001  gmcgarry branches: 1.15.2; 1.15.8;
- remove dependency on libsa by mkboot since it is a host tool.
- adjust for endianness of host.

Cross-compiling of ELF bootblocks now works.
 1.14 12-May-2001  gmcgarry size -> ${SIZE}
 1.13 02-Jan-2001  simonb branches: 1.13.2;
Convert both bootblocks and mkboot to use libsa's loadfile(), and make
both ELF aware.
 1.12 16-Dec-2000  simonb Use sys/conf/newvers_stand.sh instead of local script.
 1.11 23-Jan-2000  mycroft Clean up the machine symlink stuff ever so slightly. Needs to be
standardized between files.
 1.10 21-Dec-1999  frueauf As per Chris G. Demetriou <cgd@netbsd.org> don't install
loadfile_machdep.h into /usr/include/hp300/, instead create a
link for machine and hp300 in ${.OBJDIR} like
sys/arch/alpha/stand/Makefile.buildboot does for alpha.
 1.9 14-Dec-1999  thorpej Optimize for space.
 1.8 14-Dec-1999  thorpej Include loadfile() (and a.out support for loadfile()) in libsa.
 1.7 13-Nov-1999  thorpej Backout my libsa changes.
 1.6 11-Nov-1999  thorpej No longer need to build libkern.
 1.5 13-Feb-1999  lukem branches: 1.5.8; 1.5.10; 1.5.14;
convert from NOxxx= to MKxxx=no.
include <bsd.own.mk> if testing a MKxxx variable.
 1.4 09-May-1997  mycroft Eliminate bogus redefinitions of standard targets.
 1.3 17-Apr-1997  thorpej STRIP -> STRIPFLAG
 1.2 04-Feb-1997  thorpej Add support for transparent handling of decompressing read, useful
for gzip'd kernels and miniroot images.
 1.1 04-Feb-1997  thorpej Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.5.14.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.5.10.1 15-Nov-1999  fvdl Sync with -current
 1.5.8.2 05-Jan-2001  bouyer Sync with HEAD
 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.13.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.15.8.4 20-Jun-2002  nathanw Catch up to -current.
 1.15.8.3 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.15.8.2 08-Jan-2002  nathanw Catch up to -current.
 1.15.8.1 27-May-2001  nathanw file Makefile.buildboot was added on branch nathanw_sa on 2002-01-08 00:24:46 +0000
 1.15.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.15.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.19.6.1 30-May-2002  tv Pull up revision 1.20 (requested by thorpej in ticket #90):
Add -ffreestanding to CFLAGS.
 1.19.4.1 14-Jul-2002  gehenna catch up with -current.
 1.20.6.4 29-Nov-2004  skrll Sync with HEAD.
 1.20.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.20.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.20.6.1 03-Aug-2004  skrll Sync with HEAD
 1.24.4.1 02-Apr-2005  he Pull up revision 1.25 (requested by jmc in ticket #1025):
Convert mkboot into a full cross tool. Last hurdle for hp300 to
building on non NetBSD/bsd hosts.
 1.26.84.1 19-Oct-2008  haad Sync with HEAD.
 1.26.82.1 18-Jul-2008  simonb Sync with head.
 1.26.80.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.26.78.1 04-May-2009  yamt sync with head.
 1.26.74.1 28-Sep-2008  mjf Sync with HEAD.
 1.27.8.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.27.2.1 28-Apr-2009  skrll Sync with HEAD.
 1.29.8.2 17-Feb-2011  bouyer Sync with HEAD
 1.29.8.1 08-Feb-2011  bouyer Sync with HEAD
 1.29.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.29.4.1 05-Mar-2011  rmind sync with head
 1.32.18.1 18-May-2014  rmind sync with head
 1.32.14.2 03-Dec-2017  jdolecek update from HEAD
 1.32.14.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.32.10.1 21-May-2014  bouyer Pull up following revision(s) (requested by tsutsui in ticket #1058):
sys/arch/hp300/conf/files.hp300: revision 1.88
sys/arch/hp300/include/autoconf.h: revision 1.13
sys/dev/ic/sti.c: revision 1.17
sys/arch/hp300/dev/frodo.c: revision 1.31
sys/arch/hp300/conf/GENERIC: revision 1.173
sys/arch/hp300/hp300/machdep.c: revision 1.229
sys/arch/hp300/dev/frodo.c: revision 1.32
sys/arch/hp300/hp300/autoconf.c: revision 1.102
sys/arch/hp300/dev/frodoreg.h: revision 1.5
sys/arch/hp300/stand/common/ite_sti.c: revision 1.1
sys/arch/hp300/stand/common/itevar.h: revision 1.16
sys/arch/hp300/hp300/autoconf.c: revision 1.105
sys/arch/hp300/dev/sti_sgcvar.h: revision 1.1
sys/arch/hp300/stand/common/apci.c: revision 1.12
sys/arch/hp300/stand/common/apci.c: revision 1.13
sys/arch/hp300/dev/dnkbd.c: revision 1.6
sys/arch/hp300/dev/dnkbd.c: revision 1.7
sys/arch/hp300/stand/inst/version: revision 1.12
sys/arch/hp300/dev/com_frodo.c: revision 1.9
sys/arch/hp300/stand/common/ite.c: revision 1.17
sys/arch/hp300/conf/GENERIC: revision 1.181
sys/arch/hp300/dev/sti_sgc.c: revision 1.1
sys/arch/hp300/stand/common/dnkbd.c: revision 1.13
sys/arch/hp300/dev/sti_sgc.c: revision 1.2
sys/dev/ic/stivar.h: revision 1.8
sys/arch/hp300/dev/rtc.c: revision 1.21
sys/arch/hp300/conf/INSTALL: revision 1.56
sys/arch/hp300/conf/INSTALL: revision 1.58
sys/arch/hp300/stand/uboot/version: revision 1.19
sys/arch/hp300/stand/common/samachdep.h: revision 1.17
sys/arch/hp300/stand/common/clock.c: revision 1.12
sys/arch/hp300/dev/mcclock_frodo.c: revision 1.1
sys/arch/hp300/stand/Makefile.buildboot: revision 1.34
sys/arch/hp300/conf/files.hp300: revision 1.87
Add sti at sgc framebuffer.
Ported from OpenBSD by kiyohara@.
Fix a botch on switching from apci (and dca) to MI com(4) 10 years ago.
I.e. fix apci device address per FRODO_BASE macro change
in frodoreg.h rev 1.2. Now bootloader works with serial console
on HP425e (which has only com at frodo).
Thanks to miod@openbsd for providing his 425e.
Add sti(4) at sgc screen console support. From (the late) OpenBSD/hp300.
Tested on HP9000/425e, which was sent from Miod Vallat and
demonstrated at Open Source unConference 2014 Kagawa.
Check the service switch on 425e to select apci serial console.
Taken from OpenBSD/hp300. See the following comment for details:
> * Check the service switch. On the 425e, this is a physical
> * switch, unlike other frodo-based machines, so we can use it
> * as a serial vs internal video selector, since the PROM can not
> * be configured for serial console.
Add proper RealTime Clock support for HP9000/425e.
As the OpenBSD/hp300 page says 425e doesn't have the traditional
RTC at intio (as it also lacks DCA 16550 serial at intio?),
but after a few hour investigation it turns out that
425e uses mc146818 compatible calendar clock in
the Apollo "frodo" utility chip and the frodo chip on
425e actually has the 32kHz OSC and is actually backed up
by the onboard lithium battery.
Tested on HP425e (with mcclock) and HP362 (with old rtc).
Add RTC support for HP9000/425e to bootloader too.
Also put several cleanup:
- make local functions and variables static
- use proper variable types
- some KNF
Note it turns out that extreme slowness of netboot on hp300 is
caused by the too slow access of the traditional RTC chip at intio
(i.e. netboot on 425e is so much faster than others). Oh well.
Add proper consinit(9) support for sti(4) at sgc framebuffer on hp300.
The cnattach functions for sti(4) and service switch check method
for 425e in com_frodo.c are taken from OpenBSD.
The strategy how to choose the console device in hp300_cninit() is
quite diverged from 4.4BSD and OpenBSD so it's tweaked by me.
Also put several changes in sti_sgc.c to reduce diffs from OpenBSD/hp300.
Tested on 425e and 362 (which still uses gendiofb(4), not sti(4)).
XXX: sti(4) requires uvm_km_alloc(9) and uvm_map_protect(9)
to copy and call ROM functions on the executable memory region, so
it can be called before UVM and related initializations are complete.
Probably it's time to consider about MI "deferred consinit()" API
in init_main.c (or elsewhere) for modern complicated VM system...
Also fix the apci device address in dnkbd.c as apci.c rev 1.12:
http://mail-index.netbsd.org/source-changes/2014/04/10/msg053940.html
Finally dnkbd(4) is confirmed working at least on bootloader.
Thanks again to Miod Vallat.
Make the Apollo Domain keyboard actually work.
Tested on HP9000/425e and the keyboard model A1630-82001 R2 (RX-60857-HW)
provided by Miod Vallat. Mouse support needs more work.
Pull random notes on the Apollo Domain keyboard from ancient PR/3528.
Bump versions to denote recent 425e related changes.
Probe mcclock only on 425e to avoid an extra "not configured" message.
Add and enable sti(4) at sgc in install kernels for 425e.
Tested on both serial console and framebuffer console.
(switched by the service switch on the back panel)
 1.32.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.33.2.1 10-Aug-2014  tls Rebase.
 1.34.4.2 28-Aug-2017  skrll Sync with HEAD
 1.34.4.1 19-Mar-2016  skrll Sync with HEAD
 1.35.4.1 21-Apr-2017  bouyer Sync with HEAD
 1.35.2.1 26-Apr-2017  pgoyette Sync with HEAD
 1.36.30.1 01-Aug-2021  thorpej Sync with HEAD.
 1.36.18.1 14-Jul-2021  martin Pull up following revision(s) (requested by tsutsui in ticket #1323):

sys/arch/hp300/dev/rd.c: revision 1.109
sys/arch/hp300/stand/Makefile.buildboot: revision 1.37
sys/arch/hp300/stand/common/ct.c: revision 1.8
sys/arch/hp300/dev/hpibvar.h: revision 1.22
sys/arch/hp300/dev/ct.c: revision 1.62
sys/arch/hp300/dev/hpibvar.h: revision 1.23
sys/arch/hp300/dev/ct.c: revision 1.63
sys/arch/hp300/dev/hpibvar.h: revision 1.24
sys/arch/hp300/dev/mt.c: revision 1.55
sys/arch/hp300/dev/rdreg.h: revision 1.14
sys/arch/hp300/dev/hpib.c: revision 1.43 (via patch)
sys/arch/hp300/dev/rdreg.h: revision 1.15
sys/arch/hp300/dev/rdreg.h: revision 1.16
sys/arch/hp300/dev/rdreg.h: revision 1.17
etc/etc.hp300/MAKEDEV.conf: revision 1.15
sys/arch/hp300/stand/common/hpibvar.h: revision 1.6
sys/arch/hp300/stand/common/rd.c: revision 1.11
sys/arch/hp300/dev/ctreg.h: revision 1.11
sys/arch/hp300/dev/rdvar.h: revision 1.24
sys/arch/hp300/dev/rdvar.h: revision 1.25
sys/arch/hp300/dev/rdvar.h: revision 1.26
sys/arch/hp300/dev/rd.c: revision 1.103
sys/arch/hp300/dev/rd.c: revision 1.104
sys/arch/hp300/dev/rd.c: revision 1.105
sys/arch/hp300/dev/rd.c: revision 1.106
sys/arch/hp300/dev/rd.c: revision 1.107
sys/arch/hp300/dev/rd.c: revision 1.108

Consistently use #define<tab> here.

Consistently use #define<tab> as rdreg.h.

No need to bother to use aprint_debug(9) inside #ifdef DEBUG block.

Pull HP-IB probe fixes from OpenBSD/hp300.
https://marc.info/?l=openbsd-cvs&m=113217630426615&w=2

Overhaul the way HP-IB devices are probed. We will now do an exhaustive
probe of the (slave, punit) tuple space, since this is the only way we
can get a dual disk or dual tape enclosure to attach two devices of the
same kind.

This allows using multiple rd(4) disk images on the same slave emulated
by HPDisk (and probably the real 9122D with dual floppy disk drives).

Thanks to Miod Vallat for suggesting this fix.

Move attach messages from common rdident() to explicit rdattach().

Cleanup duplicated CS/80 indentify structures. From OpenBSD.
https://marc.info/?l=openbsd-cvs&m=113227249626888&w=2

Define the CS/80 identify structure only once and correctly, instead of
duplicating it in every CS/80 driver and using an hardcoded number for
its size.
No functional change.
https://marc.info/?l=openbsd-cvs&m=113273001020159&w=2

Pick HP-IB describe structures changes from main kernel code here as well.

Add support of multiple rd(4) disks on all punits for HPDisk.

Special thanks to Anders Gustafsson, the author of "HPDisk"
(GPIB disk emulator) http://www.dalton.ax/hpdisk/
for providing bare boards and improving firmwares for NetBSD/hp300.

Specify -fno-unwind-tables to shrink binaries.

Before:
text data bss dec hex filename
77902 4328 137120 219350 358d6 uboot

After:
text data bss dec hex filename
64186 4328 137120 205634 32342 uboot

Create rd3 device nodes, for HPDisk.

Add Device and drive info of 2202A, 7908A, 7911A, and 7941A.

Geometries and description info are taken from hpdrive.ini.sample
in HPDrive. Briefly tested on HPDisk.

Print rd(4) capacity and geometry info as sd(4) and wd(4) do.

Before:
rd0 at hpibbus1 slave 0 punit 0: 7937H
rd0: 698 cylinders, 13 heads, 1116102 blocks, 512 bytes/block

After:
rd0 at hpibbus1 slave 0 punit 0: 7937H
rd0: 544 MB, 698 cyl, 13 head, 123 sec, 512 bytes/block x 1116102 blocks
 1.37.10.1 22-Jun-2024  martin Pull up following revision(s) (requested by tsutsui in ticket #722):

sys/fs/cd9660/cd9660_util.c: revision 1.16
sys/arch/hp300/stand/common/clock.c: revision 1.14
sys/arch/hp300/stand/common/scsireg.h: revision 1.5
sys/arch/hp300/stand/common/scsireg.h: revision 1.6
sys/arch/hp300/stand/Makefile.buildboot: revision 1.38
sys/arch/hp300/include/bus.h: revision 1.23
sys/arch/hp300/stand/Makefile.buildboot: revision 1.39
sys/arch/hp300/stand/common/sd.c: revision 1.12
sys/arch/hp300/stand/common/prf.c: revision 1.6
sys/arch/hp300/stand/common/sd.c: revision 1.13
usr.sbin/installboot/installboot.8: revision 1.106
usr.sbin/installboot/Makefile: revision 1.59
sys/arch/hp300/stand/common/devopen.c: revision 1.14
usr.sbin/installboot/installboot.8: revision 1.107
sys/arch/hp300/stand/common/ite_dumb.c: revision 1.2
sys/arch/hp300/stand/common/devopen.c: revision 1.15
usr.sbin/installboot/installboot.8: revision 1.108
sys/fs/cd9660/cd9660_extern.h: revision 1.29
usr.sbin/installboot/installboot.8: revision 1.109
tools/Makefile.nbincludes: revision 1.11 (patch)
sys/arch/hp300/dev/rboxreg.h: revision 1.3
sys/arch/hp300/stand/common/scsivar.h: revision 1.5
sys/arch/hp300/dev/dnkbd.c: revision 1.14
sys/arch/hp300/hp300/trap.c: revision 1.156
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.12
sys/arch/hp300/dev/frodoreg.h: revision 1.6
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.13
sys/arch/hp300/stand/common/ite_sti.c: revision 1.2
sys/arch/hp300/stand/common/hil.c: revision 1.15
usr.sbin/installboot/arch/hp300.c: revision 1.18
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.14
sys/arch/hp300/dev/rbox.c: revision 1.4
usr.sbin/installboot/arch/hp300.c: revision 1.19
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.15
sys/sys/bootblock.h: revision 1.59
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.16
usr.sbin/installboot/installboot.h: revision 1.44
sys/arch/hp300/stand/mkboot/volhdr.h: file removal
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.17
sys/arch/hp300/dev/hpib.c: revision 1.45
usr.sbin/installboot/installboot.h: revision 1.45
usr.sbin/installboot/cd9660.c: revision 1.1
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.18
sys/arch/hp300/dev/topcatreg.h: revision 1.3
usr.sbin/installboot/cd9660.c: revision 1.2
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.19
sys/arch/hp300/stand/inst/inst.c: revision 1.25
sys/arch/hp300/stand/uboot/Makefile: revision 1.12
sys/arch/hp300/dev/dvbox.c: revision 1.4
sys/arch/hp300/dev/dma.c: revision 1.45
sys/arch/hp300/stand/uboot/Makefile: revision 1.13
sys/arch/hp300/stand/common/rd.c: revision 1.16
sys/arch/hp300/stand/inst/Makefile: revision 1.12
distrib/hp300/cdroms/installcd/Makefile: revision 1.4
sys/arch/hp300/stand/mkboot/volhdr.h: revision 1.6
sys/arch/hp300/stand/common/machdep.c: revision 1.16
usr.sbin/installboot/fstypes.c: revision 1.14
sys/arch/hp300/hp300/machdep.c: revision 1.238
sys/arch/hp300/include/cpu.h: revision 1.73
sys/arch/hp300/dev/diofbreg.h: revision 1.4
sys/arch/hp300/stand/common/scsi.c: revision 1.12
sys/arch/hp300/stand/common/netio.c: revision 1.19
sys/arch/hp300/stand/common/scsi.c: revision 1.13
sys/arch/hp300/dev/sti_sgc.c: revision 1.8
sys/arch/hp300/dev/rtc.c: revision 1.22
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.20
sys/arch/hp300/stand/common/conf.h: revision 1.4
sys/arch/hp300/hp300/autoconf.c: revision 1.111
sys/arch/hp300/stand/common/conf.c: revision 1.15
sys/arch/hp300/stand/mkboot/Makefile: revision 1.12
sys/arch/hp300/stand/mkboot/Makefile: revision 1.13
sys/arch/hp300/hp300/autoconf.c: revision 1.114
sys/arch/hp300/dev/dcmreg.h: revision 1.11
sys/arch/hp300/dev/diofbvar.h: revision 1.4
sys/arch/hp300/dev/dcm.c: revision 1.91
sys/fs/cd9660/cd9660_util.c: revision 1.15
sys/arch/hp300/dev/mcclock_frodo.c: revision 1.2

TAB/space cleanup.

installboot(8): formatting improvements

Use Ar foo instead of <foo>; this is mdoc.

Other formatting tweaks.
installboot(8): fix up markup

Don't overuse .Sy - when everything is highlighted, nothing is. Use
.Ic for options &c to get correct PostScript output (both are bold in
plain text).

Use Aq Ar inside .Pa, as both Pa and Ar are rendered as underscored
text in plain text output, and the distinction is lost.

Don't set examples in bold, but give them .Pp space around - they are
much easier to read this way.

Use consistent -width in FILES.
document how to use installboot on netbsd/vax.

PR/57909: Jan-Benedict Glaw: Don't include (build) timestamp when doing a
reproducible build
fix usage string, improve error handling.
add missing chunk for repro-build. fix gcc warnings.
avoid stringop truncation, fix copyright string to prevent assembler warnings.

Fix build as a tool (Jan-Benedict Glaw)

Fix integer overflow of strtol(3) for "loadpoint" address on ILP32 hosts.

This strtol(3) was introduced in rev 1.12 for PR/57909 after netbsd-10,
but it returns LONG_MAX (0x7FFFFFFF) for 0xFFF00000 on ILP32 hosts and
the wrong loadpoint causes "NOT ENOUGH MEMORY" error by the BOOTROMs
on loading uboot.lif on (at least) my 9000/360 and 9000/425t.

Misc cosmetic changes for mostly readability.
- KNF and add some newlines per blocks
- define and use proper bintobcd() macro
- make local functions and variables static

The same uboot.lif binaries are generated.

Rename ${PROGAOUT} -> ${PROGELF} to reflect reality.
Use proper signedness for the LIF file system data structures.

Ancient 4.3BSD used short and int for location, file size, file type,
and addresses etc. but all of them should be unsigned.

Also rename several variables and add comments for readability.
The LIF file system info can be found in "The HPDir Project" page:
https://www.hp9845.net/9845/projects/hpdir/
The same uboot.lif binaries are generated.

Add a preliminary CD boot support to uboot for preparation of PR/54455.
Briefly tested on mame, but not enalbed yet.

Recognize SCSI CD-ROM devices as a booted device properly.

Necessary for PR port-hp300/54455, to boot an md root root RAMDISK

kernel from CD-ROM without "WARNING: can't find match for bootdev:"
prompt.

Sync with src/sys/arch/hp300/stand/mkboot/volhdr.h rev 1.6.
https://mail-index.netbsd.org/source-changes/2024/05/07/msg151195.html

Use proper signedness for the LIF file system data structures.
mkboot should use this MI <sys/bootblock.h> and volhdr.h should
be removed soon.

Use MI <sys/bootblock.h> to refer LIF filesystem structures.
This should have been done when LIF definitions were initially added
to <sys/bootblock.h> for MI installboot(8).

Enable SUPPORT_CD on uboot.

Make cd9660_util.c usable in userland tools like installboot(8).

This was partially done for src/distrib/cdrom/macppc_installboot,
but more strict prototypes are necessary for native binary builds.

Install cd9660 related system headers for tools installboot(8) builds.

Reorder function prototypes per source files.

Add cd9660 support to search a bootloader file in the target file system.

Also add CD boot support for hp300, using a bootloader file in cd9660 fs.
This is a tool's part to close PR/54455.

HP 9000/300 machines read LIF directory entry allocated after
the LIF volume header at the top of the boot disk during bootstrap,
and a bootstrap file must be contiguously allocated on the disk
due to limitation of the LIF specification.

Current NetBSD/hp300's bootloader is larger than ~80KB so we have
to prepare a special 'boot' partition for FFS (that has only 8KB (ffsv1)
or 32KB (ffsv2) spaces) disks to put such a large bootloader.

On the other hand, on ISO9660 fs all files are allocated contiguously
so we can specify a bootloader file in the target ISO9660 directly
in the LIF directory entry.

Note we can simply use the existing "append" option to create bootable
CD ISO for hp300, but it looks some emulators (at leaset MAME) reject
such non-standard ISO files, i.e. with an appended bootloader file at
the end of the image.

Put a RAMDISK kernel and SYS_UBOOT into hp300 installcd to make it bootable.

This should finally close PR/54455.

Fix tools build errors on Cygwin.

Appease warnings on building tools/installboot on Cygwin.
 1.39.2.1 02-Aug-2025  perseant Sync with HEAD
 1.17 15-Apr-2021  mrg more -fcommon for boot programs.
 1.16 15-Mar-2009  tsutsui branches: 1.16.78;
Use <bsd.klinks.mk> to create symlinks to MD system header directories.
 1.15 24-Jun-2008  matt branches: 1.15.4; 1.15.10;
Need for machine-links to finish before building ${PROG}
 1.14 11-Dec-2005  christos branches: 1.14.74; 1.14.78; 1.14.80; 1.14.82;
merge ktrace-lwp.
 1.13 20-Jul-2003  tsutsui Create ${MACHINE_ARCH} symlink as well for stand progs.
 1.12 02-Jan-2001  simonb branches: 1.12.24;
Convert both bootblocks and mkboot to use libsa's loadfile(), and make
both ELF aware.
 1.11 06-Dec-2000  simonb Use 'make print-objdir' to get obj directory instead of guessing.
 1.10 30-Aug-2000  jhawk Use
${MAKE}
instead of
make
 1.9 31-May-2000  he branches: 1.9.2;
Add handling of "make release".
 1.8 06-Feb-1999  thorpej branches: 1.8.2; 1.8.8; 1.8.16;
STANDALONE -> _STANDALONE.
 1.7 12-May-1997  thorpej Build the standalone APCI driver.
 1.6 27-Apr-1997  thorpej srt0.s renamed to srt0.S via repository copy Magick - we want this
file to be preprocessed before it is assembled.
 1.5 24-Apr-1997  thorpej Add Domain keyboard support source files (oops, forgot to commit this
file when I integrated the rest of it!). Fixes PR #3523, from
Thorsten Frueauf <frueauf@ira.uka.de>.
 1.4 14-Apr-1997  thorpej Build HIL and Domain keyboard support. Include UK HIL keymap.
 1.3 04-Feb-1997  thorpej Set the heap limit to the last byte of the 3rd page from the
end of RAM, i.e.:

[ heap limit page][msgbuf page][ROM scratch page]
| |
heap limit end of RAM
 1.2 04-Feb-1997  thorpej Thou shalt not taunt the HP BOOTROM with silliness such as incorrect
link order.
 1.1 04-Feb-1997  thorpej Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.8.16.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.8.8.3 05-Jan-2001  bouyer Sync with HEAD
 1.8.8.2 08-Dec-2000  bouyer Sync with HEAD.
 1.8.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.8.2.1 13-Jul-2000  he Pull up revision 1.9 (requested by he):
Enhance the ``make release'' process:
o Build and install the distrib and boot bits
 1.9.2.1 13-Dec-2000  he Pull up revision 1.11 (requested by simonb):
Use 'make print-objdir' to get obj directory correctly.
 1.12.24.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.12.24.2 18-Sep-2004  skrll Sync with HEAD.
 1.12.24.1 03-Aug-2004  skrll Sync with HEAD
 1.14.82.1 27-Jun-2008  simonb Sync with head.
 1.14.80.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.14.78.1 04-May-2009  yamt sync with head.
 1.14.74.1 29-Jun-2008  mjf Sync with HEAD.
 1.15.10.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.15.4.1 28-Apr-2009  skrll Sync with HEAD.
 1.16.78.1 17-Apr-2021  thorpej Sync with HEAD.
 1.13 04-Feb-1997  thorpej Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.12 30-Jan-1997  thorpej Clean up #includes.
 1.11 14-Oct-1996  thorpej Clean up the code that sets `bootdev' based on information provided
by the BOOTROM. Also, give network devices the attention they deserve.
 1.10 26-Jun-1996  thorpej Major revamp of the boot code.

- Good bye SYS_PBOOT and SYS_NBOOT, hello SYS_UBOOT (unified boot)
Currently supports booting from SCSI and HP-IB disk and network
from a single boot block. Infrastructure for booting from
HP-IB tape is there, but it doesn't quite work yet.

- Add a slightly modified version of Gordon Ross's "rawfs",
which provides a filesystem-like interface to tape devices.
Still needs debugging (see above).

- Rename sys_inst.c to inst.c, so that the LIF directory entry
turns out right (used to look like SYS_SYS_I if loaded from
tape).

- Add a "netio_ask" hint to netio.c, so that a special instnetio.o
doesn't have to be compiled for SYS_INST. Defaults to using
bootparams, but if set, will prompt user for information
usually obtained from bootparams.

- General cleanup.
 1.9 05-Aug-1995  thorpej Catch up with an include file change I missed before.
 1.8 04-Aug-1995  thorpej Make the boot blocks compile (and work!) again.
 1.7 26-Oct-1994  cgd new RCS ID format.
 1.6 19-Sep-1994  mycroft Fix misguided attempt to reorganize bootdev, and fix a few
other miscellaneous bugs and nits.
 1.5 19-Jun-1994  hpeyerl branches: 1.5.2;
hp300/stand stuff from Lite. We can boot hp4xx series nodes now!
 1.4 26-Jan-1994  brezak hp300 stanealone bootstrap program ported to use CMU libsa
 1.3 01-Aug-1993  mycroft Add RCS identifiers (this time on the correct side of the branch), and
incorporate recent changes in netbsd-0-9 branch.
 1.2 22-May-1993  cgd add rcsids to everything and clean up headers
 1.1 13-May-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.1 13-May-1993  cgd add hp300 kernel files. generic kernel files might need some help...
 1.5.2.1 20-Sep-1994  cgd from trunk, per mycroft
 1.7 26-Jun-1996  thorpej Major revamp of the boot code.

- Good bye SYS_PBOOT and SYS_NBOOT, hello SYS_UBOOT (unified boot)
Currently supports booting from SCSI and HP-IB disk and network
from a single boot block. Infrastructure for booting from
HP-IB tape is there, but it doesn't quite work yet.

- Add a slightly modified version of Gordon Ross's "rawfs",
which provides a filesystem-like interface to tape devices.
Still needs debugging (see above).

- Rename sys_inst.c to inst.c, so that the LIF directory entry
turns out right (used to look like SYS_SYS_I if loaded from
tape).

- Add a "netio_ask" hint to netio.c, so that a special instnetio.o
doesn't have to be compiled for SYS_INST. Defaults to using
bootparams, but if set, will prompt user for information
usually obtained from bootparams.

- General cleanup.
 1.6 21-Feb-1995  mycroft Use the libsa exec().
 1.5 21-Feb-1995  mycroft Tweak to make the twiddler look better.
 1.4 26-Oct-1994  cgd new RCS ID format.
 1.3 26-Jan-1994  brezak hp300 stanealone bootstrap program ported to use CMU libsa
 1.2 22-May-1993  cgd add rcsids to everything and clean up headers
 1.1 13-May-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.1 13-May-1993  cgd add hp300 kernel files. generic kernel files might need some help...
 1.4 04-Feb-1997  thorpej Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.3 20-Feb-1995  mycroft Update to the new RCS id convention.
 1.2 19-Feb-1995  mycroft Don't panic if the battery is dead.
 1.1 19-Feb-1995  mycroft Add unfinished netboot code, and reorganize the Makefile somewhat.
 1.13 04-Feb-1997  thorpej Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.12 14-Oct-1996  thorpej Add a standalone driver entry point that sets the physical unit (HP-IB's
equivalent of a LUN) in `bootdev'. This is needed to properly detect the
boot device if booted from the tape unit of an HP-IB disk/tape combo.
 1.11 26-Jun-1996  thorpej Major revamp of the boot code.

- Good bye SYS_PBOOT and SYS_NBOOT, hello SYS_UBOOT (unified boot)
Currently supports booting from SCSI and HP-IB disk and network
from a single boot block. Infrastructure for booting from
HP-IB tape is there, but it doesn't quite work yet.

- Add a slightly modified version of Gordon Ross's "rawfs",
which provides a filesystem-like interface to tape devices.
Still needs debugging (see above).

- Rename sys_inst.c to inst.c, so that the LIF directory entry
turns out right (used to look like SYS_SYS_I if loaded from
tape).

- Add a "netio_ask" hint to netio.c, so that a special instnetio.o
doesn't have to be compiled for SYS_INST. Defaults to using
bootparams, but if set, will prompt user for information
usually obtained from bootparams.

- General cleanup.
 1.10 23-Sep-1995  thorpej Re-arrange a mite; for the system installation program. Catch up with libsa
changes.
 1.9 02-Sep-1995  thorpej Add support for network booting; uses the following procedure:
rbootd->rarp->bootparam->nfs
Add "reset" option to disk and network boot prompts to reload boot code.
 1.8 05-Aug-1995  thorpej Catch up with an include file change I missed before.
 1.7 04-Aug-1995  thorpej Make the boot blocks compile (and work!) again.
 1.6 19-Feb-1995  mycroft Add unfinished netboot code, and reorganize the Makefile somewhat.
 1.5 26-Oct-1994  cgd new RCS ID format.
 1.4 19-Jun-1994  hpeyerl hp300/stand stuff from Lite. We can boot hp4xx series nodes now!
 1.3 26-Jan-1994  brezak hp300 stanealone bootstrap program ported to use CMU libsa
 1.2 22-May-1993  cgd add rcsids to everything and clean up headers
 1.1 13-May-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.1 13-May-1993  cgd add hp300 kernel files. generic kernel files might need some help...
 1.10 04-Feb-1997  thorpej Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.9 04-Oct-1995  thorpej Determine the select code of the console device, or -1 for internal grf.
Pass this value to the kernel in register d5. This value isn't currently
used by the kernel, but will be in the future.
 1.8 05-Aug-1995  thorpej Catch up with an include file change I missed before.
 1.7 04-Aug-1995  thorpej Make the boot blocks compile (and work!) again.
 1.6 26-Oct-1994  cgd new RCS ID format.
 1.5 19-Feb-1994  hpeyerl fix up some #include's.
 1.4 26-Jan-1994  brezak hp300 stanealone bootstrap program ported to use CMU libsa
 1.3 01-Aug-1993  mycroft Add RCS identifiers (this time on the correct side of the branch), and
incorporate recent changes in netbsd-0-9 branch.
 1.2 22-May-1993  cgd add rcsids to everything and clean up headers
 1.1 13-May-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.1 13-May-1993  cgd add hp300 kernel files. generic kernel files might need some help...
 1.4 04-Feb-1997  thorpej Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.3 04-Oct-1995  thorpej Determine the select code of the console device, or -1 for internal grf.
Pass this value to the kernel in register d5. This value isn't currently
used by the kernel, but will be in the future.
 1.2 05-Aug-1995  thorpej Catch up with an include file change I missed before.
 1.1 04-Aug-1995  thorpej Make the boot blocks compile (and work!) again.
 1.10 04-Feb-1997  thorpej Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.9 14-Oct-1996  thorpej Implement ctpunit(), a "set physical unit" entry point.
 1.8 06-Oct-1996  thorpej Fixup ctstrategy() calling convention. The standalone ct driver
works again.
 1.7 23-Sep-1995  thorpej Catch up with libsa changes.
 1.6 26-Oct-1994  cgd new RCS ID format.
 1.5 19-Sep-1994  mycroft Fix misguided attempt to reorganize bootdev, and fix a few
other miscellaneous bugs and nits.
 1.4 09-Mar-1994  brezak branches: 1.4.2;
Fix for disk (and tape) units > 0
 1.3 26-Jan-1994  brezak hp300 stanealone bootstrap program ported to use CMU libsa
 1.2 22-May-1993  cgd add rcsids to everything and clean up headers
 1.1 13-May-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.1 13-May-1993  cgd add hp300 kernel files. generic kernel files might need some help...
 1.4.2.1 20-Sep-1994  cgd from trunk, per mycroft
 1.11 04-Feb-1997  thorpej Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.10 06-Oct-1996  mycroft Serial console changes:
* Enable FIFO with trigger level 1.
* Set DTR and RTS so terminals are happy.
* Do not set IEN.
 1.9 26-Feb-1996  thorpej branches: 1.9.4;
Adjust for the new console code; CONSCODE is now a kernel option, not
a dca-specific constant. For now, hardwire standalone DCA console
at select code 9 (which is what the old constant expanded to). Really
should make the way the bootblock console is probed look just like how
the kernel console is probed.
 1.8 04-Oct-1995  thorpej Determine the select code of the console device, or -1 for internal grf.
Pass this value to the kernel in register d5. This value isn't currently
used by the kernel, but will be in the future.
 1.7 05-Aug-1995  thorpej Catch up with an include file change I missed before.
 1.6 04-Aug-1995  thorpej Make the boot blocks compile (and work!) again.
 1.5 26-Oct-1994  cgd new RCS ID format.
 1.4 19-Feb-1994  hpeyerl fix up some #include's.
 1.3 26-Jan-1994  brezak hp300 stanealone bootstrap program ported to use CMU libsa
 1.2 22-May-1993  cgd add rcsids to everything and clean up headers
 1.1 13-May-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.1 13-May-1993  cgd add hp300 kernel files. generic kernel files might need some help...
 1.9.4.1 10-Dec-1996  mycroft From trunk:
Set serial port parameters sanely for a serial console.
 1.11 04-Feb-1997  thorpej Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.10 30-Jan-1997  thorpej Clean up #includes.
 1.9 27-Feb-1996  scottr make this compile again, since CONUNIT is no longer defined for us.
per Jason.
 1.8 04-Oct-1995  thorpej Determine the select code of the console device, or -1 for internal grf.
Pass this value to the kernel in register d5. This value isn't currently
used by the kernel, but will be in the future.
 1.7 05-Aug-1995  thorpej Catch up with an include file change I missed before.
 1.6 04-Aug-1995  thorpej Make the boot blocks compile (and work!) again.
 1.5 26-Oct-1994  cgd new RCS ID format.
 1.4 19-Feb-1994  hpeyerl fix up some #include's.
 1.3 26-Jan-1994  brezak hp300 stanealone bootstrap program ported to use CMU libsa
 1.2 22-May-1993  cgd add rcsids to everything and clean up headers
 1.1 13-May-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.1 13-May-1993  cgd add hp300 kernel files. generic kernel files might need some help...
 1.2 04-Feb-1997  thorpej Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.1 30-Jan-1997  thorpej Commit this to the right place, this time.

The boot blocks do a primitive form of autoconfiguration. Duplicate some
of the old config strcutures for the benefit of the boot blocks; they
don't need something as flexible as the kernel does.
 1.8 04-Feb-1997  thorpej Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.7 14-Oct-1996  thorpej Garbage collect some hackish code that was needed when we had a lame
kernel setroot(). The device type for network boot is set like any
other device now. Also, call the punit entry point for device drivers
to properly set `bootdev'.
 1.6 26-Jun-1996  thorpej Major revamp of the boot code.

- Good bye SYS_PBOOT and SYS_NBOOT, hello SYS_UBOOT (unified boot)
Currently supports booting from SCSI and HP-IB disk and network
from a single boot block. Infrastructure for booting from
HP-IB tape is there, but it doesn't quite work yet.

- Add a slightly modified version of Gordon Ross's "rawfs",
which provides a filesystem-like interface to tape devices.
Still needs debugging (see above).

- Rename sys_inst.c to inst.c, so that the LIF directory entry
turns out right (used to look like SYS_SYS_I if loaded from
tape).

- Add a "netio_ask" hint to netio.c, so that a special instnetio.o
doesn't have to be compiled for SYS_INST. Defaults to using
bootparams, but if set, will prompt user for information
usually obtained from bootparams.

- General cleanup.
 1.5 05-Aug-1995  thorpej Catch up with an include file change I missed before.
 1.4 04-Aug-1995  thorpej Make the boot blocks compile (and work!) again.
 1.3 26-Oct-1994  cgd new RCS ID format.
 1.2 19-Sep-1994  mycroft Fix misguided attempt to reorganize bootdev, and fix a few
other miscellaneous bugs and nits.
 1.1 26-Jan-1994  brezak branches: 1.1.2;
hp300 stanealone bootstrap program ported to use CMU libsa
 1.1.2.1 20-Sep-1994  cgd from trunk, per mycroft
 1.6 04-Feb-1997  thorpej Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.5 05-Aug-1995  thorpej Catch up with an include file change I missed before.
 1.4 26-Oct-1994  cgd new RCS ID format.
 1.3 26-Jan-1994  brezak hp300 stanealone bootstrap program ported to use CMU libsa
 1.2 22-May-1993  cgd add rcsids to everything and clean up headers
 1.1 13-May-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.1 13-May-1993  cgd add hp300 kernel files. generic kernel files might need some help...
 1.7 04-Feb-1997  thorpej Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.6 30-Jan-1997  thorpej Clean up #includes.
 1.5 26-Oct-1994  cgd new RCS ID format.
 1.4 26-Jan-1994  brezak hp300 stanealone bootstrap program ported to use CMU libsa
 1.3 02-Sep-1993  mycroft Ditto.
 1.2 22-May-1993  cgd add rcsids to everything and clean up headers
 1.1 13-May-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.1 13-May-1993  cgd add hp300 kernel files. generic kernel files might need some help...
 1.6 04-Feb-1997  thorpej Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.5 30-Jan-1997  thorpej Clean up #includes.
 1.4 26-Oct-1994  cgd new RCS ID format.
 1.3 26-Jan-1994  brezak hp300 stanealone bootstrap program ported to use CMU libsa
 1.2 22-May-1993  cgd add rcsids to everything and clean up headers
 1.1 13-May-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.1 13-May-1993  cgd add hp300 kernel files. generic kernel files might need some help...
 1.5 04-Feb-1997  thorpej Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.4 26-Oct-1994  cgd new RCS ID format.
 1.3 26-Jan-1994  brezak hp300 stanealone bootstrap program ported to use CMU libsa
 1.2 22-May-1993  cgd add rcsids to everything and clean up headers
 1.1 13-May-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.1 13-May-1993  cgd add hp300 kernel files. generic kernel files might need some help...
 1.10 04-Feb-1997  thorpej Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.9 30-Jan-1997  thorpej Clean up #includes.
 1.8 01-Jan-1996  thorpej Add the last revision previous to the switch to the MI LANCE code of
hp300/dev/if_lereg.h to the standalone code; the standalone LANCE driver
for the hp300 needs it.
 1.7 19-Oct-1995  thorpej Truncate the incoming packet if it doesn't fit into the buffer.
 1.6 02-Sep-1995  thorpej branches: 1.6.2;
Add support for network booting; uses the following procedure:
rbootd->rarp->bootparam->nfs
Add "reset" option to disk and network boot prompts to reload boot code.
 1.5 05-Aug-1995  thorpej Catch up with an include file change I missed before.
 1.4 04-Aug-1995  thorpej Make the boot blocks compile (and work!) again.
 1.3 20-Feb-1995  mycroft Update to the new RCS id convention.
 1.2 19-Feb-1995  mycroft Don't stall if we get packets back-to-back.
 1.1 19-Feb-1995  mycroft Add unfinished netboot code, and reorganize the Makefile somewhat.
 1.6.2.1 19-Oct-1995  thorpej Update from trunk; truncate the incoming packet if it doesn't fit into
the buffer.
 1.2 04-Feb-1997  thorpej Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.1 01-Jan-1996  thorpej Add the last revision previous to the switch to the MI LANCE code of
hp300/dev/if_lereg.h to the standalone code; the standalone LANCE driver
for the hp300 needs it.
 1.7 04-Feb-1997  thorpej Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.6 21-Dec-1996  thorpej This wasn't just a spelling error... I invented a whole new word!
 1.5 14-Oct-1996  thorpej Move the machdep_start() code into machdep.c. No need for different
versions of this function anymore, now that we have a sane kernel setroot().
 1.4 07-Oct-1996  thorpej Add support for copying the miniroot from HP-IB cartridge tape.
 1.3 11-Sep-1996  thorpej When opening a disk for non-filesystem i/o, make sure we only return
an error condition when an error occurs.

Bug noticed by Terry Lambert <terry@lambert.org>.
 1.2 26-Jun-1996  thorpej Oops, forgot this required change in previous commit.
 1.1 26-Jun-1996  thorpej Major revamp of the boot code.

- Good bye SYS_PBOOT and SYS_NBOOT, hello SYS_UBOOT (unified boot)
Currently supports booting from SCSI and HP-IB disk and network
from a single boot block. Infrastructure for booting from
HP-IB tape is there, but it doesn't quite work yet.

- Add a slightly modified version of Gordon Ross's "rawfs",
which provides a filesystem-like interface to tape devices.
Still needs debugging (see above).

- Rename sys_inst.c to inst.c, so that the LIF directory entry
turns out right (used to look like SYS_SYS_I if loaded from
tape).

- Add a "netio_ask" hint to netio.c, so that a special instnetio.o
doesn't have to be compiled for SYS_INST. Defaults to using
bootparams, but if set, will prompt user for information
usually obtained from bootparams.

- General cleanup.
 1.4 05-Aug-1994  mycroft Clean up deleted files.
 1.3 22-Jun-1994  mycroft Update an #include.
 1.2 22-May-1993  cgd add rcsids to everything and clean up headers
 1.1 13-May-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.1 13-May-1993  cgd add hp300 kernel files. generic kernel files might need some help...
 1.3 04-Feb-1997  thorpej Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 04-Aug-1994  brezak branches: 1.1.2;
Use installboot.sh from 4.4 instead of installboot.c
 1.1.2.2 04-Aug-1994  brezak Use installboot.sh from 4.4 instead of installboot.c
 1.1.2.1 04-Aug-1994  brezak file installboot.sh was added on branch netbsd-1-0 on 1994-08-04 19:42:19 +0000
 1.13 04-Feb-1997  thorpej Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.12 30-Jan-1997  thorpej Clean up #includes.
 1.11 03-Mar-1996  thorpej Catch up with ITE data structure changes.
 1.10 04-Oct-1995  thorpej Determine the select code of the console device, or -1 for internal grf.
Pass this value to the kernel in register d5. This value isn't currently
used by the kernel, but will be in the future.
 1.9 05-Aug-1995  thorpej Catch up with an include file change I missed before.
 1.8 04-Aug-1995  thorpej Make the boot blocks compile (and work!) again.
 1.7 26-Oct-1994  cgd new RCS ID format.
 1.6 19-Jun-1994  hpeyerl hp300/stand stuff from Lite. We can boot hp4xx series nodes now!
 1.5 19-Feb-1994  hpeyerl fix up some #include's.
 1.4 26-Jan-1994  brezak hp300 stanealone bootstrap program ported to use CMU libsa
 1.3 01-Aug-1993  mycroft Add RCS identifiers (this time on the correct side of the branch), and
incorporate recent changes in netbsd-0-9 branch.
 1.2 22-May-1993  cgd add rcsids to everything and clean up headers
 1.1 13-May-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.1 13-May-1993  cgd add hp300 kernel files. generic kernel files might need some help...
 1.9 04-Feb-1997  thorpej Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.8 03-Mar-1996  thorpej Catch up with ITE data structure changes.
 1.7 26-Oct-1994  cgd new RCS ID format.
 1.6 19-Jun-1994  hpeyerl hp300/stand stuff from Lite. We can boot hp4xx series nodes now!
 1.5 19-Feb-1994  hpeyerl fix up some #include's.
 1.4 26-Jan-1994  brezak hp300 stanealone bootstrap program ported to use CMU libsa
 1.3 01-Aug-1993  mycroft Add RCS identifiers (this time on the correct side of the branch), and
incorporate recent changes in netbsd-0-9 branch.
 1.2 22-May-1993  cgd add rcsids to everything and clean up headers
 1.1 13-May-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.1 13-May-1993  cgd add hp300 kernel files. generic kernel files might need some help...
 1.9 04-Feb-1997  thorpej Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.8 03-Mar-1996  thorpej Catch up with ITE data structure changes.
 1.7 26-Oct-1994  cgd new RCS ID format.
 1.6 19-Jun-1994  hpeyerl hp300/stand stuff from Lite. We can boot hp4xx series nodes now!
 1.5 19-Feb-1994  hpeyerl fix up some #include's.
 1.4 26-Jan-1994  brezak hp300 stanealone bootstrap program ported to use CMU libsa
 1.3 02-Sep-1993  mycroft Ditto.
 1.2 22-May-1993  cgd add rcsids to everything and clean up headers
 1.1 13-May-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.1 13-May-1993  cgd add hp300 kernel files. generic kernel files might need some help...
 1.4 04-Feb-1997  thorpej Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.3 03-Mar-1996  thorpej Catch up with ITE data structure changes.
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 19-Jun-1994  hpeyerl hp300/stand stuff from Lite. We can boot hp4xx series nodes now!
 1.9 04-Feb-1997  thorpej Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.8 03-Mar-1996  thorpej Catch up with ITE data structure changes.
 1.7 26-Oct-1994  cgd new RCS ID format.
 1.6 19-Jun-1994  hpeyerl hp300/stand stuff from Lite. We can boot hp4xx series nodes now!
 1.5 19-Feb-1994  hpeyerl fix up some #include's.
 1.4 26-Jan-1994  brezak hp300 stanealone bootstrap program ported to use CMU libsa
 1.3 01-Aug-1993  mycroft Add RCS identifiers (this time on the correct side of the branch), and
incorporate recent changes in netbsd-0-9 branch.
 1.2 22-May-1993  cgd add rcsids to everything and clean up headers
 1.1 13-May-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.1 13-May-1993  cgd add hp300 kernel files. generic kernel files might need some help...
 1.9 04-Feb-1997  thorpej Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.8 03-Mar-1996  thorpej Catch up with ITE data structure changes.
 1.7 26-Oct-1994  cgd new RCS ID format.
 1.6 19-Jun-1994  hpeyerl hp300/stand stuff from Lite. We can boot hp4xx series nodes now!
 1.5 19-Feb-1994  hpeyerl fix up some #include's.
 1.4 26-Jan-1994  brezak hp300 stanealone bootstrap program ported to use CMU libsa
 1.3 01-Aug-1993  mycroft Add RCS identifiers (this time on the correct side of the branch), and
incorporate recent changes in netbsd-0-9 branch.
 1.2 22-May-1993  cgd add rcsids to everything and clean up headers
 1.1 13-May-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.1 13-May-1993  cgd add hp300 kernel files. generic kernel files might need some help...
 1.9 04-Feb-1997  thorpej Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.8 03-Mar-1996  thorpej Catch up with ITE data structure changes.
 1.7 26-Oct-1994  cgd new RCS ID format.
 1.6 19-Jun-1994  hpeyerl hp300/stand stuff from Lite. We can boot hp4xx series nodes now!
 1.5 19-Feb-1994  hpeyerl fix up some #include's.
 1.4 26-Jan-1994  brezak hp300 stanealone bootstrap program ported to use CMU libsa
 1.3 01-Aug-1993  mycroft Add RCS identifiers (this time on the correct side of the branch), and
incorporate recent changes in netbsd-0-9 branch.
 1.2 22-May-1993  cgd add rcsids to everything and clean up headers
 1.1 13-May-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.1 13-May-1993  cgd add hp300 kernel files. generic kernel files might need some help...
 1.2 04-Feb-1997  thorpej Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.1 03-Mar-1996  thorpej Catch up with ITE data structure changes.
 1.7 04-Feb-1997  thorpej Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.6 14-Oct-1996  thorpej Move the machdep_start() code into machdep.c. No need for different
versions of this function anymore, now that we have a sane kernel setroot().
 1.5 26-Oct-1994  cgd new RCS ID format.
 1.4 26-Jan-1994  brezak hp300 stanealone bootstrap program ported to use CMU libsa
 1.3 01-Aug-1993  mycroft Add RCS identifiers (this time on the correct side of the branch), and
incorporate recent changes in netbsd-0-9 branch.
 1.2 22-May-1993  cgd add rcsids to everything and clean up headers
 1.1 13-May-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.1 13-May-1993  cgd add hp300 kernel files. generic kernel files might need some help...
 1.6 04-Feb-1997  thorpej Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.5 26-Oct-1994  cgd new RCS ID format.
 1.4 19-Jun-1994  hpeyerl hp300/stand stuff from Lite. We can boot hp4xx series nodes now!
 1.3 26-Jan-1994  brezak hp300 stanealone bootstrap program ported to use CMU libsa
 1.2 22-May-1993  cgd add rcsids to everything and clean up headers
 1.1 13-May-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.1 13-May-1993  cgd add hp300 kernel files. generic kernel files might need some help...
 1.11 26-Jun-1996  thorpej Major revamp of the boot code.

- Good bye SYS_PBOOT and SYS_NBOOT, hello SYS_UBOOT (unified boot)
Currently supports booting from SCSI and HP-IB disk and network
from a single boot block. Infrastructure for booting from
HP-IB tape is there, but it doesn't quite work yet.

- Add a slightly modified version of Gordon Ross's "rawfs",
which provides a filesystem-like interface to tape devices.
Still needs debugging (see above).

- Rename sys_inst.c to inst.c, so that the LIF directory entry
turns out right (used to look like SYS_SYS_I if loaded from
tape).

- Add a "netio_ask" hint to netio.c, so that a special instnetio.o
doesn't have to be compiled for SYS_INST. Defaults to using
bootparams, but if set, will prompt user for information
usually obtained from bootparams.

- General cleanup.
 1.10 04-Oct-1995  thorpej Put new-style RCS ids in the startup banner. Makes bootblock revisions
much easier to recognize; old method could have revision corrupted by
local RCS control.
 1.9 04-Oct-1995  thorpej Determine the select code of the console device, or -1 for internal grf.
Pass this value to the kernel in register d5. This value isn't currently
used by the kernel, but will be in the future.
 1.8 13-Sep-1995  thorpej Fix cosmetic typo in kernel name prompt.
 1.7 02-Sep-1995  thorpej Fix thinko in netboot-related changes.
 1.6 02-Sep-1995  thorpej Add support for network booting; uses the following procedure:
rbootd->rarp->bootparam->nfs
Add "reset" option to disk and network boot prompts to reload boot code.
 1.5 05-Aug-1995  thorpej Catch up with an include file change I missed before.
 1.4 04-Aug-1995  thorpej Make the boot blocks compile (and work!) again.
 1.3 20-Feb-1995  mycroft Don't define netif_debug here.
 1.2 20-Feb-1995  mycroft Slight rearrangement.
 1.1 19-Feb-1995  mycroft Add unfinished netboot code, and reorganize the Makefile somewhat.
 1.6 04-Feb-1997  thorpej Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.5 30-Jan-1997  thorpej Clean up #includes.
 1.4 06-Oct-1996  thorpej Fixup (unused) netstrategy() routine's calling convention (just returns
EIO). Garbage collect unused netioctl() - conf.c redirects netioctl()
to noioctl().
 1.3 26-Jun-1996  thorpej Major revamp of the boot code.

- Good bye SYS_PBOOT and SYS_NBOOT, hello SYS_UBOOT (unified boot)
Currently supports booting from SCSI and HP-IB disk and network
from a single boot block. Infrastructure for booting from
HP-IB tape is there, but it doesn't quite work yet.

- Add a slightly modified version of Gordon Ross's "rawfs",
which provides a filesystem-like interface to tape devices.
Still needs debugging (see above).

- Rename sys_inst.c to inst.c, so that the LIF directory entry
turns out right (used to look like SYS_SYS_I if loaded from
tape).

- Add a "netio_ask" hint to netio.c, so that a special instnetio.o
doesn't have to be compiled for SYS_INST. Defaults to using
bootparams, but if set, will prompt user for information
usually obtained from bootparams.

- General cleanup.
 1.2 23-Sep-1995  thorpej If compiled for the system installation program, prompt for myip, gateip,
netmask, serverip, and path rather than using rarp/bootparam.

Catch up with libsa changes.
 1.1 02-Sep-1995  thorpej Add support for network booting; uses the following procedure:
rbootd->rarp->bootparam->nfs
Add "reset" option to disk and network boot prompts to reload boot code.
 1.6 04-Feb-1997  thorpej Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.5 05-Aug-1995  thorpej Catch up with an include file change I missed before.
 1.4 26-Oct-1994  cgd new RCS ID format.
 1.3 26-Jan-1994  brezak hp300 stanealone bootstrap program ported to use CMU libsa
 1.2 22-May-1993  cgd add rcsids to everything and clean up headers
 1.1 13-May-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.1 13-May-1993  cgd add hp300 kernel files. generic kernel files might need some help...
 1.11 26-Jun-1996  thorpej Major revamp of the boot code.

- Good bye SYS_PBOOT and SYS_NBOOT, hello SYS_UBOOT (unified boot)
Currently supports booting from SCSI and HP-IB disk and network
from a single boot block. Infrastructure for booting from
HP-IB tape is there, but it doesn't quite work yet.

- Add a slightly modified version of Gordon Ross's "rawfs",
which provides a filesystem-like interface to tape devices.
Still needs debugging (see above).

- Rename sys_inst.c to inst.c, so that the LIF directory entry
turns out right (used to look like SYS_SYS_I if loaded from
tape).

- Add a "netio_ask" hint to netio.c, so that a special instnetio.o
doesn't have to be compiled for SYS_INST. Defaults to using
bootparams, but if set, will prompt user for information
usually obtained from bootparams.

- General cleanup.
 1.10 04-Oct-1995  thorpej Put new-style RCS ids in the startup banner. Makes bootblock revisions
much easier to recognize; old method could have revision corrupted by
local RCS control.
 1.9 04-Oct-1995  thorpej Determine the select code of the console device, or -1 for internal grf.
Pass this value to the kernel in register d5. This value isn't currently
used by the kernel, but will be in the future.
 1.8 02-Sep-1995  thorpej Add support for network booting; uses the following procedure:
rbootd->rarp->bootparam->nfs
Add "reset" option to disk and network boot prompts to reload boot code.
 1.7 05-Aug-1995  thorpej Catch up with an include file change I missed before.
 1.6 04-Aug-1995  thorpej Make the boot blocks compile (and work!) again.
 1.5 21-Feb-1995  mycroft Use the libsa exec().
 1.4 21-Feb-1995  mycroft Tweak to make the twiddler look better.
 1.3 26-Oct-1994  cgd new RCS ID format.
 1.2 19-Sep-1994  mycroft Fix misguided attempt to reorganize bootdev, and fix a few
other miscellaneous bugs and nits.
 1.1 26-Jan-1994  brezak branches: 1.1.2;
hp300 stanealone bootstrap program ported to use CMU libsa
 1.1.2.1 20-Sep-1994  cgd from trunk, per mycroft
 1.6 04-Feb-1997  thorpej Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.5 26-Oct-1994  cgd new RCS ID format.
 1.4 22-Aug-1994  brezak branches: 1.4.2;
Don't echo here
 1.3 26-Jan-1994  brezak hp300 stanealone bootstrap program ported to use CMU libsa
 1.2 22-May-1993  cgd add rcsids to everything and clean up headers
 1.1 13-May-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.1 13-May-1993  cgd add hp300 kernel files. generic kernel files might need some help...
 1.4.2.2 22-Aug-1994  brezak Don't echo here
 1.4.2.1 22-Aug-1994  brezak file prf.c was added on branch netbsd-1-0 on 1994-08-22 21:41:24 +0000
 1.3 04-Feb-1997  thorpej Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.2 06-Oct-1996  thorpej Garbage-collect some sun3-specific stuff, add some debugging code,
and KNF.
 1.1 26-Jun-1996  thorpej Major revamp of the boot code.

- Good bye SYS_PBOOT and SYS_NBOOT, hello SYS_UBOOT (unified boot)
Currently supports booting from SCSI and HP-IB disk and network
from a single boot block. Infrastructure for booting from
HP-IB tape is there, but it doesn't quite work yet.

- Add a slightly modified version of Gordon Ross's "rawfs",
which provides a filesystem-like interface to tape devices.
Still needs debugging (see above).

- Rename sys_inst.c to inst.c, so that the LIF directory entry
turns out right (used to look like SYS_SYS_I if loaded from
tape).

- Add a "netio_ask" hint to netio.c, so that a special instnetio.o
doesn't have to be compiled for SYS_INST. Defaults to using
bootparams, but if set, will prompt user for information
usually obtained from bootparams.

- General cleanup.
 1.2 04-Feb-1997  thorpej Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.1 26-Jun-1996  thorpej Major revamp of the boot code.

- Good bye SYS_PBOOT and SYS_NBOOT, hello SYS_UBOOT (unified boot)
Currently supports booting from SCSI and HP-IB disk and network
from a single boot block. Infrastructure for booting from
HP-IB tape is there, but it doesn't quite work yet.

- Add a slightly modified version of Gordon Ross's "rawfs",
which provides a filesystem-like interface to tape devices.
Still needs debugging (see above).

- Rename sys_inst.c to inst.c, so that the LIF directory entry
turns out right (used to look like SYS_SYS_I if loaded from
tape).

- Add a "netio_ask" hint to netio.c, so that a special instnetio.o
doesn't have to be compiled for SYS_INST. Defaults to using
bootparams, but if set, will prompt user for information
usually obtained from bootparams.

- General cleanup.
 1.12 04-Feb-1997  thorpej Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.11 21-Dec-1996  thorpej Fix several semantic bugs:
- Always allow RAW_PART to be opened, regardless of the partition table.
- Never do partition translation on RAW_PART; it's always offset 0.
- Always make sure the disklabel is read from RAW_PART.
- Make *strategy() return values consistent.

This fixes a condition where a bogus partition table could be written
to the disk from SYS_INST, and the user had no way to rewrite with
a correct partition table, since RAW_PART would be invalid.
 1.10 23-Sep-1995  thorpej Add *close() routines. Basically, zaps softc structure so that partition
information will be re-loaded upon next open.

Catch up with libsa changes.
 1.9 05-Aug-1995  thorpej Catch up with an include file change I missed before.
 1.8 04-Aug-1995  thorpej Make the boot blocks compile (and work!) again.
 1.7 26-Oct-1994  cgd new RCS ID format.
 1.6 19-Sep-1994  mycroft Fix misguided attempt to reorganize bootdev, and fix a few
other miscellaneous bugs and nits.
 1.5 09-Mar-1994  brezak branches: 1.5.2;
Fix for disk (and tape) units > 0
 1.4 26-Jan-1994  brezak hp300 stanealone bootstrap program ported to use CMU libsa
 1.3 01-Aug-1993  mycroft Add RCS identifiers (this time on the correct side of the branch), and
incorporate recent changes in netbsd-0-9 branch.
 1.2 22-May-1993  cgd add rcsids to everything and clean up headers
 1.1 13-May-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.1 13-May-1993  cgd add hp300 kernel files. generic kernel files might need some help...
 1.5.2.1 20-Sep-1994  cgd from trunk, per mycroft
 1.6 04-Feb-1997  thorpej Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.5 26-Oct-1994  cgd new RCS ID format.
 1.4 26-Jan-1994  brezak hp300 stanealone bootstrap program ported to use CMU libsa
 1.3 01-Aug-1993  mycroft Add RCS identifiers (this time on the correct side of the branch), and
incorporate recent changes in netbsd-0-9 branch.
 1.2 22-May-1993  cgd add rcsids to everything and clean up headers
 1.1 13-May-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.1 13-May-1993  cgd add hp300 kernel files. generic kernel files might need some help...
 1.8 04-Feb-1997  thorpej Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.7 14-Oct-1996  thorpej Garbage collect some now unneeded code, and declare the punit device
driver entry point switch.
 1.6 26-Jun-1996  thorpej Major revamp of the boot code.

- Good bye SYS_PBOOT and SYS_NBOOT, hello SYS_UBOOT (unified boot)
Currently supports booting from SCSI and HP-IB disk and network
from a single boot block. Infrastructure for booting from
HP-IB tape is there, but it doesn't quite work yet.

- Add a slightly modified version of Gordon Ross's "rawfs",
which provides a filesystem-like interface to tape devices.
Still needs debugging (see above).

- Rename sys_inst.c to inst.c, so that the LIF directory entry
turns out right (used to look like SYS_SYS_I if loaded from
tape).

- Add a "netio_ask" hint to netio.c, so that a special instnetio.o
doesn't have to be compiled for SYS_INST. Defaults to using
bootparams, but if set, will prompt user for information
usually obtained from bootparams.

- General cleanup.
 1.5 05-Aug-1995  thorpej Catch up with an include file change I missed before.
 1.4 26-Oct-1994  cgd new RCS ID format.
 1.3 26-Jan-1994  brezak hp300 stanealone bootstrap program ported to use CMU libsa
 1.2 22-May-1993  cgd add rcsids to everything and clean up headers
 1.1 13-May-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.1 13-May-1993  cgd add hp300 kernel files. generic kernel files might need some help...
 1.8 04-Feb-1997  thorpej Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.7 30-Jan-1997  thorpej Clean up #includes.
 1.6 17-Dec-1996  thorpej Always use `SLOWSCSI'. Some devices need a long delay between phase
changes, apparently. This is reported to work around some odd failures
people were seeing during first-time installation onto a SCSI disk.
 1.5 26-Oct-1994  cgd new RCS ID format.
 1.4 26-Jan-1994  brezak hp300 stanealone bootstrap program ported to use CMU libsa
 1.3 01-Aug-1993  mycroft Add RCS identifiers (this time on the correct side of the branch), and
incorporate recent changes in netbsd-0-9 branch.
 1.2 22-May-1993  cgd add rcsids to everything and clean up headers
 1.1 13-May-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.1 13-May-1993  cgd add hp300 kernel files. generic kernel files might need some help...
 1.5 04-Feb-1997  thorpej Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.4 26-Oct-1994  cgd new RCS ID format.
 1.3 26-Jan-1994  brezak hp300 stanealone bootstrap program ported to use CMU libsa
 1.2 22-May-1993  cgd add rcsids to everything and clean up headers
 1.1 13-May-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.1 13-May-1993  cgd add hp300 kernel files. generic kernel files might need some help...
 1.10 04-Feb-1997  thorpej Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.9 21-Dec-1996  thorpej Fix several semantic bugs:
- Always allow RAW_PART to be opened, regardless of the partition table.
- Never do partition translation on RAW_PART; it's always offset 0.
- Always make sure the disklabel is read from RAW_PART.
- Make *strategy() return values consistent.

This fixes a condition where a bogus partition table could be written
to the disk from SYS_INST, and the user had no way to rewrite with
a correct partition table, since RAW_PART would be invalid.
 1.8 23-Sep-1995  thorpej Add *close() routines. Basically, zaps softc structure so that partition
information will be re-loaded upon next open.

Catch up with libsa changes.
 1.7 26-Oct-1994  cgd new RCS ID format.
 1.6 19-Sep-1994  mycroft Fix misguided attempt to reorganize bootdev, and fix a few
other miscellaneous bugs and nits.
 1.5 09-Mar-1994  brezak branches: 1.5.2;
Fix for disk (and tape) units > 0
 1.4 26-Jan-1994  brezak hp300 stanealone bootstrap program ported to use CMU libsa
 1.3 01-Aug-1993  mycroft Add RCS identifiers (this time on the correct side of the branch), and
incorporate recent changes in netbsd-0-9 branch.
 1.2 22-May-1993  cgd add rcsids to everything and clean up headers
 1.1 13-May-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.1 13-May-1993  cgd add hp300 kernel files. generic kernel files might need some help...
 1.5.2.1 20-Sep-1994  cgd from trunk, per mycroft
 1.4 26-Jan-1994  mycroft Clean up deleted files.
 1.3 02-Sep-1993  mycroft Ditto.
 1.2 22-May-1993  cgd add rcsids to everything and clean up headers
 1.1 13-May-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.1 13-May-1993  cgd add hp300 kernel files. generic kernel files might need some help...
 1.4 04-Feb-1997  thorpej Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.3 02-Sep-1995  thorpej Add support for network booting; uses the following procedure:
rbootd->rarp->bootparam->nfs
Add "reset" option to disk and network boot prompts to reload boot code.
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 26-Jan-1994  brezak hp300 stanealone bootstrap program ported to use CMU libsa
 1.4 26-Jun-1996  thorpej Major revamp of the boot code.

- Good bye SYS_PBOOT and SYS_NBOOT, hello SYS_UBOOT (unified boot)
Currently supports booting from SCSI and HP-IB disk and network
from a single boot block. Infrastructure for booting from
HP-IB tape is there, but it doesn't quite work yet.

- Add a slightly modified version of Gordon Ross's "rawfs",
which provides a filesystem-like interface to tape devices.
Still needs debugging (see above).

- Rename sys_inst.c to inst.c, so that the LIF directory entry
turns out right (used to look like SYS_SYS_I if loaded from
tape).

- Add a "netio_ask" hint to netio.c, so that a special instnetio.o
doesn't have to be compiled for SYS_INST. Defaults to using
bootparams, but if set, will prompt user for information
usually obtained from bootparams.

- General cleanup.
 1.3 04-Oct-1995  thorpej branches: 1.3.6;
Put new-style RCS ids in the startup banner. Makes bootblock revisions
much easier to recognize; old method could have revision corrupted by
local RCS control.
 1.2 04-Oct-1995  thorpej Determine the select code of the console device, or -1 for internal grf.
Pass this value to the kernel in register d5. This value isn't currently
used by the kernel, but will be in the future.
 1.1 23-Sep-1995  thorpej Add a standalone system installation program. Currently implements:
* Prompt user for disklabel information and label disk.
* Copy miniroot image from NFS server to `b' partition.
* Boot kernel in miniroot image into single-user mode.
Hooks for tape support are there, but the meat for that isn't implemented yet.
 1.3.6.1 11-Sep-1996  thorpej When opening a disk for non-filesystem i/o, make sure we only return
an error condition when an error occurs.

Bug noticed by Terry Lambert <terry@lambert.org>.
 1.5 04-Feb-1997  thorpej Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.4 26-Oct-1994  cgd new RCS ID format.
 1.3 19-Sep-1994  mycroft Fix misguided attempt to reorganize bootdev, and fix a few
other miscellaneous bugs and nits.
 1.2 22-Aug-1994  brezak branches: 1.2.2;
Do echo here just like libsa::gets()
 1.1 26-Jan-1994  brezak hp300 stanealone bootstrap program ported to use CMU libsa
 1.2.2.2 20-Sep-1994  cgd from trunk, per mycroft
 1.2.2.1 22-Aug-1994  cgd file tgets.c was added on branch netbsd-1-0 on 1994-09-20 05:07:46 +0000
 1.3 04-Feb-1997  thorpej Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.2 14-Oct-1996  thorpej Move the machdep_start() code into machdep.c. No need for different
versions of this function anymore, now that we have a sane kernel setroot().
 1.1 26-Jun-1996  thorpej Major revamp of the boot code.

- Good bye SYS_PBOOT and SYS_NBOOT, hello SYS_UBOOT (unified boot)
Currently supports booting from SCSI and HP-IB disk and network
from a single boot block. Infrastructure for booting from
HP-IB tape is there, but it doesn't quite work yet.

- Add a slightly modified version of Gordon Ross's "rawfs",
which provides a filesystem-like interface to tape devices.
Still needs debugging (see above).

- Rename sys_inst.c to inst.c, so that the LIF directory entry
turns out right (used to look like SYS_SYS_I if loaded from
tape).

- Add a "netio_ask" hint to netio.c, so that a special instnetio.o
doesn't have to be compiled for SYS_INST. Defaults to using
bootparams, but if set, will prompt user for information
usually obtained from bootparams.

- General cleanup.
 1.5 04-Feb-1997  thorpej Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.4 26-Oct-1994  cgd new RCS ID format.
 1.3 26-Jan-1994  brezak hp300 stanealone bootstrap program ported to use CMU libsa
 1.2 22-May-1993  cgd add rcsids to everything and clean up headers
 1.1 13-May-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.1 13-May-1993  cgd add hp300 kernel files. generic kernel files might need some help...
 1.14 21-Apr-2023  tsutsui Remove ancient /* ARGSUSED */ lint comments.
 1.13 17-Apr-2014  tsutsui Check the service switch on 425e to select apci serial console.

Taken from OpenBSD/hp300. See the following comment for details:
>> * Check the service switch. On the 425e, this is a physical
>> * switch, unlike other frodo-based machines, so we can use it
>> * as a serial vs internal video selector, since the PROM can not
>> * be configured for serial console.
 1.12 10-Apr-2014  tsutsui Fix a botch on switching from apci (and dca) to MI com(4) 10 years ago.

I.e. fix apci device address per FRODO_BASE macro change
in frodoreg.h rev 1.2. Now bootloader works with serial console
on HP425e (which has only com at frodo).

Thanks to miod@openbsd for providing his 425e.
 1.11 08-Feb-2011  rmind branches: 1.11.4; 1.11.10; 1.11.14; 1.11.18; 1.11.28;
Remove clause 3 (UCB advertising clause) from the University of Utah
copyright. Confirmed by Mike Hibler, mike at cs.utah.edu - thanks!
Also, merge UCB and Utah copyright texts back into one, as they
originally were.

Extra verification by snj@.
 1.10 28-Apr-2008  martin branches: 1.10.22; 1.10.28; 1.10.30;
Remove clause 3 and 4 from TNF licenses
 1.9 19-Jul-2006  tsutsui branches: 1.9.58; 1.9.60; 1.9.62;
Adapt stand sources to changes of intio device offset macro.
 1.8 11-Dec-2005  christos branches: 1.8.4; 1.8.8;
merge ktrace-lwp.
 1.7 20-Feb-2005  tsutsui branches: 1.7.4;
Use ANSI function decls.
 1.6 14-Nov-2003  tsutsui branches: 1.6.8; 1.6.10;
Misc cleanup:
- KNF
- WARNSfy
- remove __P()
- remove register declarations
- const'ify some variables
- make some local functions/variables static
- bcopy -> memcpy
- bcmp -> memcmp
- bzero -> memset
- space/TAB fix
etc.
 1.5 08-Nov-2003  tsutsui Adapt to replacement of apcireg.h and dcareg.h.
 1.4 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.3 31-Jul-1999  thorpej branches: 1.3.36;
Nuke the DCA check. ACPI can only be console on a 425e.
 1.2 04-Oct-1997  thorpej branches: 1.2.12;
Copyright assigned to The NetBSD Foundation.
 1.1 12-May-1997  thorpej branches: 1.1.4;
Add a standalone APCI driver, adapted from the standalone DCA driver
by me. This driver should only be invoked when there are no other
suitable console devices present in the system. This situation currently
exists on the 425e, for which we do not have a frame buffer driver,
and who's PROM does not map the second APCI UART to select code 9,
like is done on the 4{00,25,33}{t,s}.
 1.1.4.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.2.12.1 02-Aug-1999  thorpej Update from trunk.
 1.3.36.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.3.36.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.36.2 18-Sep-2004  skrll Sync with HEAD.
 1.3.36.1 03-Aug-2004  skrll Sync with HEAD
 1.6.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.6.8.1 29-Apr-2005  kent sync with -current
 1.7.4.1 30-Dec-2006  yamt sync with head.
 1.8.8.1 11-Aug-2006  yamt sync with head
 1.8.4.1 09-Sep-2006  rpaulo sync with head
 1.9.62.1 16-May-2008  yamt sync with head.
 1.9.60.1 18-May-2008  yamt sync with head.
 1.9.58.1 02-Jun-2008  mjf Sync with HEAD.
 1.10.30.1 17-Feb-2011  bouyer Sync with HEAD
 1.10.28.1 06-Jun-2011  jruoho Sync with HEAD.
 1.10.22.1 05-Mar-2011  rmind sync with head
 1.11.28.1 10-Aug-2014  tls Rebase.
 1.11.18.1 18-May-2014  rmind sync with head
 1.11.14.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.11.10.1 21-May-2014  bouyer Pull up following revision(s) (requested by tsutsui in ticket #1058):
sys/arch/hp300/conf/files.hp300: revision 1.88
sys/arch/hp300/include/autoconf.h: revision 1.13
sys/dev/ic/sti.c: revision 1.17
sys/arch/hp300/dev/frodo.c: revision 1.31
sys/arch/hp300/conf/GENERIC: revision 1.173
sys/arch/hp300/hp300/machdep.c: revision 1.229
sys/arch/hp300/dev/frodo.c: revision 1.32
sys/arch/hp300/hp300/autoconf.c: revision 1.102
sys/arch/hp300/dev/frodoreg.h: revision 1.5
sys/arch/hp300/stand/common/ite_sti.c: revision 1.1
sys/arch/hp300/stand/common/itevar.h: revision 1.16
sys/arch/hp300/hp300/autoconf.c: revision 1.105
sys/arch/hp300/dev/sti_sgcvar.h: revision 1.1
sys/arch/hp300/stand/common/apci.c: revision 1.12
sys/arch/hp300/stand/common/apci.c: revision 1.13
sys/arch/hp300/dev/dnkbd.c: revision 1.6
sys/arch/hp300/dev/dnkbd.c: revision 1.7
sys/arch/hp300/stand/inst/version: revision 1.12
sys/arch/hp300/dev/com_frodo.c: revision 1.9
sys/arch/hp300/stand/common/ite.c: revision 1.17
sys/arch/hp300/conf/GENERIC: revision 1.181
sys/arch/hp300/dev/sti_sgc.c: revision 1.1
sys/arch/hp300/stand/common/dnkbd.c: revision 1.13
sys/arch/hp300/dev/sti_sgc.c: revision 1.2
sys/dev/ic/stivar.h: revision 1.8
sys/arch/hp300/dev/rtc.c: revision 1.21
sys/arch/hp300/conf/INSTALL: revision 1.56
sys/arch/hp300/conf/INSTALL: revision 1.58
sys/arch/hp300/stand/uboot/version: revision 1.19
sys/arch/hp300/stand/common/samachdep.h: revision 1.17
sys/arch/hp300/stand/common/clock.c: revision 1.12
sys/arch/hp300/dev/mcclock_frodo.c: revision 1.1
sys/arch/hp300/stand/Makefile.buildboot: revision 1.34
sys/arch/hp300/conf/files.hp300: revision 1.87
Add sti at sgc framebuffer.
Ported from OpenBSD by kiyohara@.
Fix a botch on switching from apci (and dca) to MI com(4) 10 years ago.
I.e. fix apci device address per FRODO_BASE macro change
in frodoreg.h rev 1.2. Now bootloader works with serial console
on HP425e (which has only com at frodo).
Thanks to miod@openbsd for providing his 425e.
Add sti(4) at sgc screen console support. From (the late) OpenBSD/hp300.
Tested on HP9000/425e, which was sent from Miod Vallat and
demonstrated at Open Source unConference 2014 Kagawa.
Check the service switch on 425e to select apci serial console.
Taken from OpenBSD/hp300. See the following comment for details:
> * Check the service switch. On the 425e, this is a physical
> * switch, unlike other frodo-based machines, so we can use it
> * as a serial vs internal video selector, since the PROM can not
> * be configured for serial console.
Add proper RealTime Clock support for HP9000/425e.
As the OpenBSD/hp300 page says 425e doesn't have the traditional
RTC at intio (as it also lacks DCA 16550 serial at intio?),
but after a few hour investigation it turns out that
425e uses mc146818 compatible calendar clock in
the Apollo "frodo" utility chip and the frodo chip on
425e actually has the 32kHz OSC and is actually backed up
by the onboard lithium battery.
Tested on HP425e (with mcclock) and HP362 (with old rtc).
Add RTC support for HP9000/425e to bootloader too.
Also put several cleanup:
- make local functions and variables static
- use proper variable types
- some KNF
Note it turns out that extreme slowness of netboot on hp300 is
caused by the too slow access of the traditional RTC chip at intio
(i.e. netboot on 425e is so much faster than others). Oh well.
Add proper consinit(9) support for sti(4) at sgc framebuffer on hp300.
The cnattach functions for sti(4) and service switch check method
for 425e in com_frodo.c are taken from OpenBSD.
The strategy how to choose the console device in hp300_cninit() is
quite diverged from 4.4BSD and OpenBSD so it's tweaked by me.
Also put several changes in sti_sgc.c to reduce diffs from OpenBSD/hp300.
Tested on 425e and 362 (which still uses gendiofb(4), not sti(4)).
XXX: sti(4) requires uvm_km_alloc(9) and uvm_map_protect(9)
to copy and call ROM functions on the executable memory region, so
it can be called before UVM and related initializations are complete.
Probably it's time to consider about MI "deferred consinit()" API
in init_main.c (or elsewhere) for modern complicated VM system...
Also fix the apci device address in dnkbd.c as apci.c rev 1.12:
http://mail-index.netbsd.org/source-changes/2014/04/10/msg053940.html
Finally dnkbd(4) is confirmed working at least on bootloader.
Thanks again to Miod Vallat.
Make the Apollo Domain keyboard actually work.
Tested on HP9000/425e and the keyboard model A1630-82001 R2 (RX-60857-HW)
provided by Miod Vallat. Mouse support needs more work.
Pull random notes on the Apollo Domain keyboard from ancient PR/3528.
Bump versions to denote recent 425e related changes.
Probe mcclock only on 425e to avoid an extra "not configured" message.
Add and enable sti(4) at sgc in install kernels for 425e.
Tested on both serial console and framebuffer console.
(switched by the service switch on the back panel)
 1.11.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.2 11-Dec-2005  christos merge ktrace-lwp.
 1.1 08-Nov-2003  tsutsui branches: 1.1.4;
Move apcireg.h and dcareg.h to stand/common since they are no longer used
by kernel.
 1.1.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.1.4.2 03-Aug-2004  skrll Sync with HEAD
 1.1.4.1 08-Nov-2003  skrll file apcireg.h was added on branch ktrace-lwp on 2004-08-03 10:34:37 +0000
 1.14 05-Jul-2021  tsutsui Get rid of obsolete grfreg.h. From OpenBSD.
 1.13 08-Feb-2011  rmind branches: 1.13.72;
Remove clause 3 (UCB advertising clause) from the University of Utah
copyright. Confirmed by Mike Hibler, mike at cs.utah.edu - thanks!
Also, merge UCB and Utah copyright texts back into one, as they
originally were.

Extra verification by snj@.
 1.12 07-Feb-2011  tsutsui Resurrect and move retired ITE files that are still used by bootloaders.
 1.11 04-Mar-2007  christos branches: 1.11.66; 1.11.72; 1.11.74;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.10 21-Jul-2006  tsutsui branches: 1.10.10;
Use macro defined in dioreg.h.
 1.9 20-Jul-2006  tsutsui Identify models HP362 and HP382. From OpenBSD, tested on my HP382.

Note now options HP362 and options HP382 are required for these models
in your kernel config file.
 1.8 19-Jul-2006  tsutsui Set cpuspeed for HP_400 and HP_425 explicitly.
 1.7 19-Jul-2006  tsutsui Adapt stand sources to changes of intio device offset macro.
 1.6 11-Dec-2005  christos branches: 1.6.4; 1.6.8;
merge ktrace-lwp.
 1.5 20-Feb-2005  tsutsui branches: 1.5.4;
Use ANSI function decls.
 1.4 14-Nov-2003  tsutsui branches: 1.4.8; 1.4.10;
Misc cleanup:
- KNF
- WARNSfy
- remove __P()
- remove register declarations
- const'ify some variables
- make some local functions/variables static
- bcopy -> memcpy
- bcmp -> memcmp
- bzero -> memset
- space/TAB fix
etc.
 1.3 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.2 31-Jul-1999  thorpej branches: 1.2.36;
Add 385 and 425e SPU detection. From OpenBSD.
 1.1 04-Feb-1997  thorpej branches: 1.1.22;
Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.1.22.1 02-Aug-1999  thorpej Update from trunk.
 1.2.36.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.2.36.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.36.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.36.1 03-Aug-2004  skrll Sync with HEAD
 1.4.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.4.8.1 29-Apr-2005  kent sync with -current
 1.5.4.2 03-Sep-2007  yamt sync with head.
 1.5.4.1 30-Dec-2006  yamt sync with head.
 1.6.8.1 11-Aug-2006  yamt sync with head
 1.6.4.1 09-Sep-2006  rpaulo sync with head
 1.10.10.1 12-Mar-2007  rmind Sync with HEAD.
 1.11.74.2 17-Feb-2011  bouyer Sync with HEAD
 1.11.74.1 08-Feb-2011  bouyer Sync with HEAD
 1.11.72.1 06-Jun-2011  jruoho Sync with HEAD.
 1.11.66.1 05-Mar-2011  rmind sync with head
 1.13.72.1 01-Aug-2021  thorpej Sync with HEAD.
 1.15 17-May-2025  tsutsui Speed up hp300 netboot by reducing RTC access during timeout checks.

The read_bbc() function against HIL seems extremely slow.
It was being called on every timeout check via getsecs()
so it significantly slowed down loading a kernel via NFS.

In most cases (e.g., in common/if_le.c and libsa/net.c),
timeout checks are performed using getsecs() in busy loops
without any actual waiting. In such cases, it's not necessary
to read the precise time from the RTC on every call.

This change reduces the time to load the NetBSD/hp300 10.1 GENERIC kernel
via NFS from 260 seconds to 64 seconds on HP9000/382.
 1.14 15-Jan-2023  tsutsui branches: 1.14.6;
TAB/space cleanup.
 1.13 17-Nov-2014  christos branches: 1.13.50;
PR/49207: Kamil Rytarowski: Add sys/clock.h with generic time macros
(derived from clock_subr.h). Keep clock_subr.h with the kernel structures
and functions to reduce diffs, and have clock.h only include standalone
constants and macros.
 1.12 19-Apr-2014  tsutsui Add RTC support for HP9000/425e to bootloader too.

Also put several cleanup:
- make local functions and variables static
- use proper variable types
- some KNF

Note it turns out that extreme slowness of netboot on hp300 is
caused by the too slow access of the traditional RTC chip at intio
(i.e. netboot on 425e is so much faster than others). Oh well.
 1.11 08-Feb-2011  rmind branches: 1.11.4; 1.11.10; 1.11.14; 1.11.18; 1.11.28;
Remove clause 3 (UCB advertising clause) from the University of Utah
copyright. Confirmed by Mike Hibler, mike at cs.utah.edu - thanks!
Also, merge UCB and Utah copyright texts back into one, as they
originally were.

Extra verification by snj@.
 1.10 07-Feb-2011  tsutsui Resurrect and move retired ITE files that are still used by bootloaders.
 1.9 12-Jan-2009  tsutsui branches: 1.9.6; 1.9.8; 1.9.10;
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.8 25-Jun-2006  tsutsui branches: 1.8.58; 1.8.62; 1.8.70;
Fix unsigned/signed mismatch.
 1.7 11-Dec-2005  christos branches: 1.7.4; 1.7.8; 1.7.16;
merge ktrace-lwp.
 1.6 20-Feb-2005  tsutsui branches: 1.6.4;
Use ANSI function decls.
 1.5 07-Apr-2004  tsutsui branches: 1.5.4; 1.5.6;
Fix yet another y2k+1 bug.
 1.4 14-Nov-2003  tsutsui branches: 1.4.2;
Misc cleanup:
- KNF
- WARNSfy
- remove __P()
- remove register declarations
- const'ify some variables
- make some local functions/variables static
- bcopy -> memcpy
- bcmp -> memcmp
- bzero -> memset
- space/TAB fix
etc.
 1.3 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.2 08-Nov-2001  gmcgarry branches: 1.2.2; 1.2.12; 1.2.18;
Use crufty old clock-handling code for now.
 1.1 04-Feb-1997  thorpej branches: 1.1.40; 1.1.42;
Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.1.42.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.1.40.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.18.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.2.18.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.18.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.18.1 03-Aug-2004  skrll Sync with HEAD
 1.2.12.1 12-Apr-2004  jmc Pullup rev 1.5 (requested by tsutsui in ticket #1665)

Fix yet another y2k+1 bug.
 1.2.2.2 08-Nov-2001  gmcgarry Use crufty old clock-handling code for now.
 1.2.2.1 08-Nov-2001  gmcgarry file clock.c was added on branch nathanw_sa on 2001-11-08 07:01:34 +0000
 1.4.2.1 11-Apr-2004  jmc Pullup rev 1.5 (requested by tsutsui in ticket #115)

Fix yet another y2k+1 bug.
 1.5.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.5.4.1 29-Apr-2005  kent sync with -current
 1.6.4.1 30-Dec-2006  yamt sync with head.
 1.7.16.1 13-Jul-2006  gdamore Merge from HEAD.
 1.7.8.1 26-Jun-2006  yamt sync with head.
 1.7.4.1 09-Sep-2006  rpaulo sync with head
 1.8.70.1 19-Jan-2009  skrll Sync with HEAD.
 1.8.62.1 04-May-2009  yamt sync with head.
 1.8.58.1 17-Jan-2009  mjf Sync with HEAD.
 1.9.10.2 17-Feb-2011  bouyer Sync with HEAD
 1.9.10.1 08-Feb-2011  bouyer Sync with HEAD
 1.9.8.1 06-Jun-2011  jruoho Sync with HEAD.
 1.9.6.1 05-Mar-2011  rmind sync with head
 1.11.28.1 10-Aug-2014  tls Rebase.
 1.11.18.1 18-May-2014  rmind sync with head
 1.11.14.2 03-Dec-2017  jdolecek update from HEAD
 1.11.14.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.11.10.1 21-May-2014  bouyer Pull up following revision(s) (requested by tsutsui in ticket #1058):
sys/arch/hp300/conf/files.hp300: revision 1.88
sys/arch/hp300/include/autoconf.h: revision 1.13
sys/dev/ic/sti.c: revision 1.17
sys/arch/hp300/dev/frodo.c: revision 1.31
sys/arch/hp300/conf/GENERIC: revision 1.173
sys/arch/hp300/hp300/machdep.c: revision 1.229
sys/arch/hp300/dev/frodo.c: revision 1.32
sys/arch/hp300/hp300/autoconf.c: revision 1.102
sys/arch/hp300/dev/frodoreg.h: revision 1.5
sys/arch/hp300/stand/common/ite_sti.c: revision 1.1
sys/arch/hp300/stand/common/itevar.h: revision 1.16
sys/arch/hp300/hp300/autoconf.c: revision 1.105
sys/arch/hp300/dev/sti_sgcvar.h: revision 1.1
sys/arch/hp300/stand/common/apci.c: revision 1.12
sys/arch/hp300/stand/common/apci.c: revision 1.13
sys/arch/hp300/dev/dnkbd.c: revision 1.6
sys/arch/hp300/dev/dnkbd.c: revision 1.7
sys/arch/hp300/stand/inst/version: revision 1.12
sys/arch/hp300/dev/com_frodo.c: revision 1.9
sys/arch/hp300/stand/common/ite.c: revision 1.17
sys/arch/hp300/conf/GENERIC: revision 1.181
sys/arch/hp300/dev/sti_sgc.c: revision 1.1
sys/arch/hp300/stand/common/dnkbd.c: revision 1.13
sys/arch/hp300/dev/sti_sgc.c: revision 1.2
sys/dev/ic/stivar.h: revision 1.8
sys/arch/hp300/dev/rtc.c: revision 1.21
sys/arch/hp300/conf/INSTALL: revision 1.56
sys/arch/hp300/conf/INSTALL: revision 1.58
sys/arch/hp300/stand/uboot/version: revision 1.19
sys/arch/hp300/stand/common/samachdep.h: revision 1.17
sys/arch/hp300/stand/common/clock.c: revision 1.12
sys/arch/hp300/dev/mcclock_frodo.c: revision 1.1
sys/arch/hp300/stand/Makefile.buildboot: revision 1.34
sys/arch/hp300/conf/files.hp300: revision 1.87
Add sti at sgc framebuffer.
Ported from OpenBSD by kiyohara@.
Fix a botch on switching from apci (and dca) to MI com(4) 10 years ago.
I.e. fix apci device address per FRODO_BASE macro change
in frodoreg.h rev 1.2. Now bootloader works with serial console
on HP425e (which has only com at frodo).
Thanks to miod@openbsd for providing his 425e.
Add sti(4) at sgc screen console support. From (the late) OpenBSD/hp300.
Tested on HP9000/425e, which was sent from Miod Vallat and
demonstrated at Open Source unConference 2014 Kagawa.
Check the service switch on 425e to select apci serial console.
Taken from OpenBSD/hp300. See the following comment for details:
> * Check the service switch. On the 425e, this is a physical
> * switch, unlike other frodo-based machines, so we can use it
> * as a serial vs internal video selector, since the PROM can not
> * be configured for serial console.
Add proper RealTime Clock support for HP9000/425e.
As the OpenBSD/hp300 page says 425e doesn't have the traditional
RTC at intio (as it also lacks DCA 16550 serial at intio?),
but after a few hour investigation it turns out that
425e uses mc146818 compatible calendar clock in
the Apollo "frodo" utility chip and the frodo chip on
425e actually has the 32kHz OSC and is actually backed up
by the onboard lithium battery.
Tested on HP425e (with mcclock) and HP362 (with old rtc).
Add RTC support for HP9000/425e to bootloader too.
Also put several cleanup:
- make local functions and variables static
- use proper variable types
- some KNF
Note it turns out that extreme slowness of netboot on hp300 is
caused by the too slow access of the traditional RTC chip at intio
(i.e. netboot on 425e is so much faster than others). Oh well.
Add proper consinit(9) support for sti(4) at sgc framebuffer on hp300.
The cnattach functions for sti(4) and service switch check method
for 425e in com_frodo.c are taken from OpenBSD.
The strategy how to choose the console device in hp300_cninit() is
quite diverged from 4.4BSD and OpenBSD so it's tweaked by me.
Also put several changes in sti_sgc.c to reduce diffs from OpenBSD/hp300.
Tested on 425e and 362 (which still uses gendiofb(4), not sti(4)).
XXX: sti(4) requires uvm_km_alloc(9) and uvm_map_protect(9)
to copy and call ROM functions on the executable memory region, so
it can be called before UVM and related initializations are complete.
Probably it's time to consider about MI "deferred consinit()" API
in init_main.c (or elsewhere) for modern complicated VM system...
Also fix the apci device address in dnkbd.c as apci.c rev 1.12:
http://mail-index.netbsd.org/source-changes/2014/04/10/msg053940.html
Finally dnkbd(4) is confirmed working at least on bootloader.
Thanks again to Miod Vallat.
Make the Apollo Domain keyboard actually work.
Tested on HP9000/425e and the keyboard model A1630-82001 R2 (RX-60857-HW)
provided by Miod Vallat. Mouse support needs more work.
Pull random notes on the Apollo Domain keyboard from ancient PR/3528.
Bump versions to denote recent 425e related changes.
Probe mcclock only on 425e to avoid an extra "not configured" message.
Add and enable sti(4) at sgc in install kernels for 425e.
Tested on both serial console and framebuffer console.
(switched by the service switch on the back panel)
 1.11.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.13.50.1 22-Jun-2024  martin Pull up following revision(s) (requested by tsutsui in ticket #722):

sys/fs/cd9660/cd9660_util.c: revision 1.16
sys/arch/hp300/stand/common/clock.c: revision 1.14
sys/arch/hp300/stand/common/scsireg.h: revision 1.5
sys/arch/hp300/stand/common/scsireg.h: revision 1.6
sys/arch/hp300/stand/Makefile.buildboot: revision 1.38
sys/arch/hp300/include/bus.h: revision 1.23
sys/arch/hp300/stand/Makefile.buildboot: revision 1.39
sys/arch/hp300/stand/common/sd.c: revision 1.12
sys/arch/hp300/stand/common/prf.c: revision 1.6
sys/arch/hp300/stand/common/sd.c: revision 1.13
usr.sbin/installboot/installboot.8: revision 1.106
usr.sbin/installboot/Makefile: revision 1.59
sys/arch/hp300/stand/common/devopen.c: revision 1.14
usr.sbin/installboot/installboot.8: revision 1.107
sys/arch/hp300/stand/common/ite_dumb.c: revision 1.2
sys/arch/hp300/stand/common/devopen.c: revision 1.15
usr.sbin/installboot/installboot.8: revision 1.108
sys/fs/cd9660/cd9660_extern.h: revision 1.29
usr.sbin/installboot/installboot.8: revision 1.109
tools/Makefile.nbincludes: revision 1.11 (patch)
sys/arch/hp300/dev/rboxreg.h: revision 1.3
sys/arch/hp300/stand/common/scsivar.h: revision 1.5
sys/arch/hp300/dev/dnkbd.c: revision 1.14
sys/arch/hp300/hp300/trap.c: revision 1.156
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.12
sys/arch/hp300/dev/frodoreg.h: revision 1.6
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.13
sys/arch/hp300/stand/common/ite_sti.c: revision 1.2
sys/arch/hp300/stand/common/hil.c: revision 1.15
usr.sbin/installboot/arch/hp300.c: revision 1.18
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.14
sys/arch/hp300/dev/rbox.c: revision 1.4
usr.sbin/installboot/arch/hp300.c: revision 1.19
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.15
sys/sys/bootblock.h: revision 1.59
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.16
usr.sbin/installboot/installboot.h: revision 1.44
sys/arch/hp300/stand/mkboot/volhdr.h: file removal
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.17
sys/arch/hp300/dev/hpib.c: revision 1.45
usr.sbin/installboot/installboot.h: revision 1.45
usr.sbin/installboot/cd9660.c: revision 1.1
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.18
sys/arch/hp300/dev/topcatreg.h: revision 1.3
usr.sbin/installboot/cd9660.c: revision 1.2
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.19
sys/arch/hp300/stand/inst/inst.c: revision 1.25
sys/arch/hp300/stand/uboot/Makefile: revision 1.12
sys/arch/hp300/dev/dvbox.c: revision 1.4
sys/arch/hp300/dev/dma.c: revision 1.45
sys/arch/hp300/stand/uboot/Makefile: revision 1.13
sys/arch/hp300/stand/common/rd.c: revision 1.16
sys/arch/hp300/stand/inst/Makefile: revision 1.12
distrib/hp300/cdroms/installcd/Makefile: revision 1.4
sys/arch/hp300/stand/mkboot/volhdr.h: revision 1.6
sys/arch/hp300/stand/common/machdep.c: revision 1.16
usr.sbin/installboot/fstypes.c: revision 1.14
sys/arch/hp300/hp300/machdep.c: revision 1.238
sys/arch/hp300/include/cpu.h: revision 1.73
sys/arch/hp300/dev/diofbreg.h: revision 1.4
sys/arch/hp300/stand/common/scsi.c: revision 1.12
sys/arch/hp300/stand/common/netio.c: revision 1.19
sys/arch/hp300/stand/common/scsi.c: revision 1.13
sys/arch/hp300/dev/sti_sgc.c: revision 1.8
sys/arch/hp300/dev/rtc.c: revision 1.22
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.20
sys/arch/hp300/stand/common/conf.h: revision 1.4
sys/arch/hp300/hp300/autoconf.c: revision 1.111
sys/arch/hp300/stand/common/conf.c: revision 1.15
sys/arch/hp300/stand/mkboot/Makefile: revision 1.12
sys/arch/hp300/stand/mkboot/Makefile: revision 1.13
sys/arch/hp300/hp300/autoconf.c: revision 1.114
sys/arch/hp300/dev/dcmreg.h: revision 1.11
sys/arch/hp300/dev/diofbvar.h: revision 1.4
sys/arch/hp300/dev/dcm.c: revision 1.91
sys/fs/cd9660/cd9660_util.c: revision 1.15
sys/arch/hp300/dev/mcclock_frodo.c: revision 1.2

TAB/space cleanup.

installboot(8): formatting improvements

Use Ar foo instead of <foo>; this is mdoc.

Other formatting tweaks.
installboot(8): fix up markup

Don't overuse .Sy - when everything is highlighted, nothing is. Use
.Ic for options &c to get correct PostScript output (both are bold in
plain text).

Use Aq Ar inside .Pa, as both Pa and Ar are rendered as underscored
text in plain text output, and the distinction is lost.

Don't set examples in bold, but give them .Pp space around - they are
much easier to read this way.

Use consistent -width in FILES.
document how to use installboot on netbsd/vax.

PR/57909: Jan-Benedict Glaw: Don't include (build) timestamp when doing a
reproducible build
fix usage string, improve error handling.
add missing chunk for repro-build. fix gcc warnings.
avoid stringop truncation, fix copyright string to prevent assembler warnings.

Fix build as a tool (Jan-Benedict Glaw)

Fix integer overflow of strtol(3) for "loadpoint" address on ILP32 hosts.

This strtol(3) was introduced in rev 1.12 for PR/57909 after netbsd-10,
but it returns LONG_MAX (0x7FFFFFFF) for 0xFFF00000 on ILP32 hosts and
the wrong loadpoint causes "NOT ENOUGH MEMORY" error by the BOOTROMs
on loading uboot.lif on (at least) my 9000/360 and 9000/425t.

Misc cosmetic changes for mostly readability.
- KNF and add some newlines per blocks
- define and use proper bintobcd() macro
- make local functions and variables static

The same uboot.lif binaries are generated.

Rename ${PROGAOUT} -> ${PROGELF} to reflect reality.
Use proper signedness for the LIF file system data structures.

Ancient 4.3BSD used short and int for location, file size, file type,
and addresses etc. but all of them should be unsigned.

Also rename several variables and add comments for readability.
The LIF file system info can be found in "The HPDir Project" page:
https://www.hp9845.net/9845/projects/hpdir/
The same uboot.lif binaries are generated.

Add a preliminary CD boot support to uboot for preparation of PR/54455.
Briefly tested on mame, but not enalbed yet.

Recognize SCSI CD-ROM devices as a booted device properly.

Necessary for PR port-hp300/54455, to boot an md root root RAMDISK

kernel from CD-ROM without "WARNING: can't find match for bootdev:"
prompt.

Sync with src/sys/arch/hp300/stand/mkboot/volhdr.h rev 1.6.
https://mail-index.netbsd.org/source-changes/2024/05/07/msg151195.html

Use proper signedness for the LIF file system data structures.
mkboot should use this MI <sys/bootblock.h> and volhdr.h should
be removed soon.

Use MI <sys/bootblock.h> to refer LIF filesystem structures.
This should have been done when LIF definitions were initially added
to <sys/bootblock.h> for MI installboot(8).

Enable SUPPORT_CD on uboot.

Make cd9660_util.c usable in userland tools like installboot(8).

This was partially done for src/distrib/cdrom/macppc_installboot,
but more strict prototypes are necessary for native binary builds.

Install cd9660 related system headers for tools installboot(8) builds.

Reorder function prototypes per source files.

Add cd9660 support to search a bootloader file in the target file system.

Also add CD boot support for hp300, using a bootloader file in cd9660 fs.
This is a tool's part to close PR/54455.

HP 9000/300 machines read LIF directory entry allocated after
the LIF volume header at the top of the boot disk during bootstrap,
and a bootstrap file must be contiguously allocated on the disk
due to limitation of the LIF specification.

Current NetBSD/hp300's bootloader is larger than ~80KB so we have
to prepare a special 'boot' partition for FFS (that has only 8KB (ffsv1)
or 32KB (ffsv2) spaces) disks to put such a large bootloader.

On the other hand, on ISO9660 fs all files are allocated contiguously
so we can specify a bootloader file in the target ISO9660 directly
in the LIF directory entry.

Note we can simply use the existing "append" option to create bootable
CD ISO for hp300, but it looks some emulators (at leaset MAME) reject
such non-standard ISO files, i.e. with an appended bootloader file at
the end of the image.

Put a RAMDISK kernel and SYS_UBOOT into hp300 installcd to make it bootable.

This should finally close PR/54455.

Fix tools build errors on Cygwin.

Appease warnings on building tools/installboot on Cygwin.
 1.14.6.1 02-Aug-2025  perseant Sync with HEAD
 1.15 09-May-2024  tsutsui Add a preliminary CD boot support to uboot for preparation of PR/54455.

Briefly tested on mame, but not enalbed yet.
 1.14 11-Dec-2022  tsutsui branches: 1.14.2;
Make hp300 bootloaders UFS2 ready.
 1.13 11-Dec-2022  tsutsui Remove a #if 0'ed out unused function.
 1.12 23-Dec-2007  tsutsui Use __arraycount().
 1.11 11-Dec-2005  christos branches: 1.11.50; 1.11.60; 1.11.64;
merge ktrace-lwp.
 1.10 23-Jun-2005  junyoung branches: 1.10.2;
Use FS_OPS() macro.
 1.9 23-Jun-2005  junyoung Drop trailing spaces.
 1.8 20-Feb-2005  tsutsui Use ANSI function decls.
 1.7 14-Nov-2003  tsutsui branches: 1.7.8; 1.7.10;
Misc cleanup:
- KNF
- WARNSfy
- remove __P()
- remove register declarations
- const'ify some variables
- make some local functions/variables static
- bcopy -> memcpy
- bcmp -> memcmp
- bzero -> memset
- space/TAB fix
etc.
 1.6 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.5 02-Jan-2001  simonb branches: 1.5.24;
Convert both bootblocks and mkboot to use libsa's loadfile(), and make
both ELF aware.
 1.4 14-Dec-1999  thorpej Make it possible to strip this down a little more.
 1.3 22-Jul-1997  drochner branches: 1.3.20; 1.3.26;
Don't use <lib/libsa/if_ether.h> anymore. This was a copy of the
old (before ARP changes) <netinet/if_ether.h>, intended for
temporary use.
 1.2 15-Mar-1997  is New ARP system, supports IPv4 over any hardware link.

Some of the stuff (e.g., rarpd, bootpd, dhcpd etc., libsa) still will
only support Ethernet. Tcpdump itself should be ok, but libpcap needs
lot of work.

For the detailed change history, look at the commit log entries for
the is-newarp branch.
 1.1 04-Feb-1997  thorpej branches: 1.1.4;
Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.1.4.1 07-Mar-1997  is Use libsa copy of oldstyle if_ether.h for now
 1.3.26.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.3.20.2 05-Jan-2001  bouyer Sync with HEAD
 1.3.20.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.5.24.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.5.24.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.5.24.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.5.24.2 18-Sep-2004  skrll Sync with HEAD.
 1.5.24.1 03-Aug-2004  skrll Sync with HEAD
 1.7.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.7.8.1 29-Apr-2005  kent sync with -current
 1.10.2.1 21-Jan-2008  yamt sync with head
 1.11.64.1 02-Jan-2008  bouyer Sync with HEAD
 1.11.60.1 26-Dec-2007  ad Sync with head.
 1.11.50.1 09-Jan-2008  matt sync with HEAD
 1.14.2.1 22-Jun-2024  martin Pull up following revision(s) (requested by tsutsui in ticket #722):

sys/fs/cd9660/cd9660_util.c: revision 1.16
sys/arch/hp300/stand/common/clock.c: revision 1.14
sys/arch/hp300/stand/common/scsireg.h: revision 1.5
sys/arch/hp300/stand/common/scsireg.h: revision 1.6
sys/arch/hp300/stand/Makefile.buildboot: revision 1.38
sys/arch/hp300/include/bus.h: revision 1.23
sys/arch/hp300/stand/Makefile.buildboot: revision 1.39
sys/arch/hp300/stand/common/sd.c: revision 1.12
sys/arch/hp300/stand/common/prf.c: revision 1.6
sys/arch/hp300/stand/common/sd.c: revision 1.13
usr.sbin/installboot/installboot.8: revision 1.106
usr.sbin/installboot/Makefile: revision 1.59
sys/arch/hp300/stand/common/devopen.c: revision 1.14
usr.sbin/installboot/installboot.8: revision 1.107
sys/arch/hp300/stand/common/ite_dumb.c: revision 1.2
sys/arch/hp300/stand/common/devopen.c: revision 1.15
usr.sbin/installboot/installboot.8: revision 1.108
sys/fs/cd9660/cd9660_extern.h: revision 1.29
usr.sbin/installboot/installboot.8: revision 1.109
tools/Makefile.nbincludes: revision 1.11 (patch)
sys/arch/hp300/dev/rboxreg.h: revision 1.3
sys/arch/hp300/stand/common/scsivar.h: revision 1.5
sys/arch/hp300/dev/dnkbd.c: revision 1.14
sys/arch/hp300/hp300/trap.c: revision 1.156
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.12
sys/arch/hp300/dev/frodoreg.h: revision 1.6
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.13
sys/arch/hp300/stand/common/ite_sti.c: revision 1.2
sys/arch/hp300/stand/common/hil.c: revision 1.15
usr.sbin/installboot/arch/hp300.c: revision 1.18
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.14
sys/arch/hp300/dev/rbox.c: revision 1.4
usr.sbin/installboot/arch/hp300.c: revision 1.19
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.15
sys/sys/bootblock.h: revision 1.59
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.16
usr.sbin/installboot/installboot.h: revision 1.44
sys/arch/hp300/stand/mkboot/volhdr.h: file removal
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.17
sys/arch/hp300/dev/hpib.c: revision 1.45
usr.sbin/installboot/installboot.h: revision 1.45
usr.sbin/installboot/cd9660.c: revision 1.1
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.18
sys/arch/hp300/dev/topcatreg.h: revision 1.3
usr.sbin/installboot/cd9660.c: revision 1.2
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.19
sys/arch/hp300/stand/inst/inst.c: revision 1.25
sys/arch/hp300/stand/uboot/Makefile: revision 1.12
sys/arch/hp300/dev/dvbox.c: revision 1.4
sys/arch/hp300/dev/dma.c: revision 1.45
sys/arch/hp300/stand/uboot/Makefile: revision 1.13
sys/arch/hp300/stand/common/rd.c: revision 1.16
sys/arch/hp300/stand/inst/Makefile: revision 1.12
distrib/hp300/cdroms/installcd/Makefile: revision 1.4
sys/arch/hp300/stand/mkboot/volhdr.h: revision 1.6
sys/arch/hp300/stand/common/machdep.c: revision 1.16
usr.sbin/installboot/fstypes.c: revision 1.14
sys/arch/hp300/hp300/machdep.c: revision 1.238
sys/arch/hp300/include/cpu.h: revision 1.73
sys/arch/hp300/dev/diofbreg.h: revision 1.4
sys/arch/hp300/stand/common/scsi.c: revision 1.12
sys/arch/hp300/stand/common/netio.c: revision 1.19
sys/arch/hp300/stand/common/scsi.c: revision 1.13
sys/arch/hp300/dev/sti_sgc.c: revision 1.8
sys/arch/hp300/dev/rtc.c: revision 1.22
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.20
sys/arch/hp300/stand/common/conf.h: revision 1.4
sys/arch/hp300/hp300/autoconf.c: revision 1.111
sys/arch/hp300/stand/common/conf.c: revision 1.15
sys/arch/hp300/stand/mkboot/Makefile: revision 1.12
sys/arch/hp300/stand/mkboot/Makefile: revision 1.13
sys/arch/hp300/hp300/autoconf.c: revision 1.114
sys/arch/hp300/dev/dcmreg.h: revision 1.11
sys/arch/hp300/dev/diofbvar.h: revision 1.4
sys/arch/hp300/dev/dcm.c: revision 1.91
sys/fs/cd9660/cd9660_util.c: revision 1.15
sys/arch/hp300/dev/mcclock_frodo.c: revision 1.2

TAB/space cleanup.

installboot(8): formatting improvements

Use Ar foo instead of <foo>; this is mdoc.

Other formatting tweaks.
installboot(8): fix up markup

Don't overuse .Sy - when everything is highlighted, nothing is. Use
.Ic for options &c to get correct PostScript output (both are bold in
plain text).

Use Aq Ar inside .Pa, as both Pa and Ar are rendered as underscored
text in plain text output, and the distinction is lost.

Don't set examples in bold, but give them .Pp space around - they are
much easier to read this way.

Use consistent -width in FILES.
document how to use installboot on netbsd/vax.

PR/57909: Jan-Benedict Glaw: Don't include (build) timestamp when doing a
reproducible build
fix usage string, improve error handling.
add missing chunk for repro-build. fix gcc warnings.
avoid stringop truncation, fix copyright string to prevent assembler warnings.

Fix build as a tool (Jan-Benedict Glaw)

Fix integer overflow of strtol(3) for "loadpoint" address on ILP32 hosts.

This strtol(3) was introduced in rev 1.12 for PR/57909 after netbsd-10,
but it returns LONG_MAX (0x7FFFFFFF) for 0xFFF00000 on ILP32 hosts and
the wrong loadpoint causes "NOT ENOUGH MEMORY" error by the BOOTROMs
on loading uboot.lif on (at least) my 9000/360 and 9000/425t.

Misc cosmetic changes for mostly readability.
- KNF and add some newlines per blocks
- define and use proper bintobcd() macro
- make local functions and variables static

The same uboot.lif binaries are generated.

Rename ${PROGAOUT} -> ${PROGELF} to reflect reality.
Use proper signedness for the LIF file system data structures.

Ancient 4.3BSD used short and int for location, file size, file type,
and addresses etc. but all of them should be unsigned.

Also rename several variables and add comments for readability.
The LIF file system info can be found in "The HPDir Project" page:
https://www.hp9845.net/9845/projects/hpdir/
The same uboot.lif binaries are generated.

Add a preliminary CD boot support to uboot for preparation of PR/54455.
Briefly tested on mame, but not enalbed yet.

Recognize SCSI CD-ROM devices as a booted device properly.

Necessary for PR port-hp300/54455, to boot an md root root RAMDISK

kernel from CD-ROM without "WARNING: can't find match for bootdev:"
prompt.

Sync with src/sys/arch/hp300/stand/mkboot/volhdr.h rev 1.6.
https://mail-index.netbsd.org/source-changes/2024/05/07/msg151195.html

Use proper signedness for the LIF file system data structures.
mkboot should use this MI <sys/bootblock.h> and volhdr.h should
be removed soon.

Use MI <sys/bootblock.h> to refer LIF filesystem structures.
This should have been done when LIF definitions were initially added
to <sys/bootblock.h> for MI installboot(8).

Enable SUPPORT_CD on uboot.

Make cd9660_util.c usable in userland tools like installboot(8).

This was partially done for src/distrib/cdrom/macppc_installboot,
but more strict prototypes are necessary for native binary builds.

Install cd9660 related system headers for tools installboot(8) builds.

Reorder function prototypes per source files.

Add cd9660 support to search a bootloader file in the target file system.

Also add CD boot support for hp300, using a bootloader file in cd9660 fs.
This is a tool's part to close PR/54455.

HP 9000/300 machines read LIF directory entry allocated after
the LIF volume header at the top of the boot disk during bootstrap,
and a bootstrap file must be contiguously allocated on the disk
due to limitation of the LIF specification.

Current NetBSD/hp300's bootloader is larger than ~80KB so we have
to prepare a special 'boot' partition for FFS (that has only 8KB (ffsv1)
or 32KB (ffsv2) spaces) disks to put such a large bootloader.

On the other hand, on ISO9660 fs all files are allocated contiguously
so we can specify a bootloader file in the target ISO9660 directly
in the LIF directory entry.

Note we can simply use the existing "append" option to create bootable
CD ISO for hp300, but it looks some emulators (at leaset MAME) reject
such non-standard ISO files, i.e. with an appended bootloader file at
the end of the image.

Put a RAMDISK kernel and SYS_UBOOT into hp300 installcd to make it bootable.

This should finally close PR/54455.

Fix tools build errors on Cygwin.

Appease warnings on building tools/installboot on Cygwin.
 1.4 09-May-2024  tsutsui Add a preliminary CD boot support to uboot for preparation of PR/54455.

Briefly tested on mame, but not enalbed yet.
 1.3 11-Dec-2022  tsutsui branches: 1.3.2;
Make hp300 bootloaders UFS2 ready.
 1.2 11-Dec-2005  christos merge ktrace-lwp.
 1.1 14-Nov-2003  tsutsui branches: 1.1.4;
Misc cleanup:
- KNF
- WARNSfy
- remove __P()
- remove register declarations
- const'ify some variables
- make some local functions/variables static
- bcopy -> memcpy
- bcmp -> memcmp
- bzero -> memset
- space/TAB fix
etc.
 1.1.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.1.4.2 03-Aug-2004  skrll Sync with HEAD
 1.1.4.1 14-Nov-2003  skrll file conf.h was added on branch ktrace-lwp on 2004-08-03 10:34:37 +0000
 1.3.2.1 22-Jun-2024  martin Pull up following revision(s) (requested by tsutsui in ticket #722):

sys/fs/cd9660/cd9660_util.c: revision 1.16
sys/arch/hp300/stand/common/clock.c: revision 1.14
sys/arch/hp300/stand/common/scsireg.h: revision 1.5
sys/arch/hp300/stand/common/scsireg.h: revision 1.6
sys/arch/hp300/stand/Makefile.buildboot: revision 1.38
sys/arch/hp300/include/bus.h: revision 1.23
sys/arch/hp300/stand/Makefile.buildboot: revision 1.39
sys/arch/hp300/stand/common/sd.c: revision 1.12
sys/arch/hp300/stand/common/prf.c: revision 1.6
sys/arch/hp300/stand/common/sd.c: revision 1.13
usr.sbin/installboot/installboot.8: revision 1.106
usr.sbin/installboot/Makefile: revision 1.59
sys/arch/hp300/stand/common/devopen.c: revision 1.14
usr.sbin/installboot/installboot.8: revision 1.107
sys/arch/hp300/stand/common/ite_dumb.c: revision 1.2
sys/arch/hp300/stand/common/devopen.c: revision 1.15
usr.sbin/installboot/installboot.8: revision 1.108
sys/fs/cd9660/cd9660_extern.h: revision 1.29
usr.sbin/installboot/installboot.8: revision 1.109
tools/Makefile.nbincludes: revision 1.11 (patch)
sys/arch/hp300/dev/rboxreg.h: revision 1.3
sys/arch/hp300/stand/common/scsivar.h: revision 1.5
sys/arch/hp300/dev/dnkbd.c: revision 1.14
sys/arch/hp300/hp300/trap.c: revision 1.156
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.12
sys/arch/hp300/dev/frodoreg.h: revision 1.6
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.13
sys/arch/hp300/stand/common/ite_sti.c: revision 1.2
sys/arch/hp300/stand/common/hil.c: revision 1.15
usr.sbin/installboot/arch/hp300.c: revision 1.18
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.14
sys/arch/hp300/dev/rbox.c: revision 1.4
usr.sbin/installboot/arch/hp300.c: revision 1.19
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.15
sys/sys/bootblock.h: revision 1.59
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.16
usr.sbin/installboot/installboot.h: revision 1.44
sys/arch/hp300/stand/mkboot/volhdr.h: file removal
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.17
sys/arch/hp300/dev/hpib.c: revision 1.45
usr.sbin/installboot/installboot.h: revision 1.45
usr.sbin/installboot/cd9660.c: revision 1.1
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.18
sys/arch/hp300/dev/topcatreg.h: revision 1.3
usr.sbin/installboot/cd9660.c: revision 1.2
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.19
sys/arch/hp300/stand/inst/inst.c: revision 1.25
sys/arch/hp300/stand/uboot/Makefile: revision 1.12
sys/arch/hp300/dev/dvbox.c: revision 1.4
sys/arch/hp300/dev/dma.c: revision 1.45
sys/arch/hp300/stand/uboot/Makefile: revision 1.13
sys/arch/hp300/stand/common/rd.c: revision 1.16
sys/arch/hp300/stand/inst/Makefile: revision 1.12
distrib/hp300/cdroms/installcd/Makefile: revision 1.4
sys/arch/hp300/stand/mkboot/volhdr.h: revision 1.6
sys/arch/hp300/stand/common/machdep.c: revision 1.16
usr.sbin/installboot/fstypes.c: revision 1.14
sys/arch/hp300/hp300/machdep.c: revision 1.238
sys/arch/hp300/include/cpu.h: revision 1.73
sys/arch/hp300/dev/diofbreg.h: revision 1.4
sys/arch/hp300/stand/common/scsi.c: revision 1.12
sys/arch/hp300/stand/common/netio.c: revision 1.19
sys/arch/hp300/stand/common/scsi.c: revision 1.13
sys/arch/hp300/dev/sti_sgc.c: revision 1.8
sys/arch/hp300/dev/rtc.c: revision 1.22
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.20
sys/arch/hp300/stand/common/conf.h: revision 1.4
sys/arch/hp300/hp300/autoconf.c: revision 1.111
sys/arch/hp300/stand/common/conf.c: revision 1.15
sys/arch/hp300/stand/mkboot/Makefile: revision 1.12
sys/arch/hp300/stand/mkboot/Makefile: revision 1.13
sys/arch/hp300/hp300/autoconf.c: revision 1.114
sys/arch/hp300/dev/dcmreg.h: revision 1.11
sys/arch/hp300/dev/diofbvar.h: revision 1.4
sys/arch/hp300/dev/dcm.c: revision 1.91
sys/fs/cd9660/cd9660_util.c: revision 1.15
sys/arch/hp300/dev/mcclock_frodo.c: revision 1.2

TAB/space cleanup.

installboot(8): formatting improvements

Use Ar foo instead of <foo>; this is mdoc.

Other formatting tweaks.
installboot(8): fix up markup

Don't overuse .Sy - when everything is highlighted, nothing is. Use
.Ic for options &c to get correct PostScript output (both are bold in
plain text).

Use Aq Ar inside .Pa, as both Pa and Ar are rendered as underscored
text in plain text output, and the distinction is lost.

Don't set examples in bold, but give them .Pp space around - they are
much easier to read this way.

Use consistent -width in FILES.
document how to use installboot on netbsd/vax.

PR/57909: Jan-Benedict Glaw: Don't include (build) timestamp when doing a
reproducible build
fix usage string, improve error handling.
add missing chunk for repro-build. fix gcc warnings.
avoid stringop truncation, fix copyright string to prevent assembler warnings.

Fix build as a tool (Jan-Benedict Glaw)

Fix integer overflow of strtol(3) for "loadpoint" address on ILP32 hosts.

This strtol(3) was introduced in rev 1.12 for PR/57909 after netbsd-10,
but it returns LONG_MAX (0x7FFFFFFF) for 0xFFF00000 on ILP32 hosts and
the wrong loadpoint causes "NOT ENOUGH MEMORY" error by the BOOTROMs
on loading uboot.lif on (at least) my 9000/360 and 9000/425t.

Misc cosmetic changes for mostly readability.
- KNF and add some newlines per blocks
- define and use proper bintobcd() macro
- make local functions and variables static

The same uboot.lif binaries are generated.

Rename ${PROGAOUT} -> ${PROGELF} to reflect reality.
Use proper signedness for the LIF file system data structures.

Ancient 4.3BSD used short and int for location, file size, file type,
and addresses etc. but all of them should be unsigned.

Also rename several variables and add comments for readability.
The LIF file system info can be found in "The HPDir Project" page:
https://www.hp9845.net/9845/projects/hpdir/
The same uboot.lif binaries are generated.

Add a preliminary CD boot support to uboot for preparation of PR/54455.
Briefly tested on mame, but not enalbed yet.

Recognize SCSI CD-ROM devices as a booted device properly.

Necessary for PR port-hp300/54455, to boot an md root root RAMDISK

kernel from CD-ROM without "WARNING: can't find match for bootdev:"
prompt.

Sync with src/sys/arch/hp300/stand/mkboot/volhdr.h rev 1.6.
https://mail-index.netbsd.org/source-changes/2024/05/07/msg151195.html

Use proper signedness for the LIF file system data structures.
mkboot should use this MI <sys/bootblock.h> and volhdr.h should
be removed soon.

Use MI <sys/bootblock.h> to refer LIF filesystem structures.
This should have been done when LIF definitions were initially added
to <sys/bootblock.h> for MI installboot(8).

Enable SUPPORT_CD on uboot.

Make cd9660_util.c usable in userland tools like installboot(8).

This was partially done for src/distrib/cdrom/macppc_installboot,
but more strict prototypes are necessary for native binary builds.

Install cd9660 related system headers for tools installboot(8) builds.

Reorder function prototypes per source files.

Add cd9660 support to search a bootloader file in the target file system.

Also add CD boot support for hp300, using a bootloader file in cd9660 fs.
This is a tool's part to close PR/54455.

HP 9000/300 machines read LIF directory entry allocated after
the LIF volume header at the top of the boot disk during bootstrap,
and a bootstrap file must be contiguously allocated on the disk
due to limitation of the LIF specification.

Current NetBSD/hp300's bootloader is larger than ~80KB so we have
to prepare a special 'boot' partition for FFS (that has only 8KB (ffsv1)
or 32KB (ffsv2) spaces) disks to put such a large bootloader.

On the other hand, on ISO9660 fs all files are allocated contiguously
so we can specify a bootloader file in the target ISO9660 directly
in the LIF directory entry.

Note we can simply use the existing "append" option to create bootable
CD ISO for hp300, but it looks some emulators (at leaset MAME) reject
such non-standard ISO files, i.e. with an appended bootloader file at
the end of the image.

Put a RAMDISK kernel and SYS_UBOOT into hp300 installcd to make it bootable.

This should finally close PR/54455.

Fix tools build errors on Cygwin.

Appease warnings on building tools/installboot on Cygwin.
 1.7 08-Feb-2011  rmind Remove clause 3 (UCB advertising clause) from the University of Utah
copyright. Confirmed by Mike Hibler, mike at cs.utah.edu - thanks!
Also, merge UCB and Utah copyright texts back into one, as they
originally were.

Extra verification by snj@.
 1.6 11-Dec-2005  christos branches: 1.6.100; 1.6.106; 1.6.108;
merge ktrace-lwp.
 1.5 20-Feb-2005  tsutsui Use ANSI function decls.
 1.4 14-Nov-2003  tsutsui branches: 1.4.8; 1.4.10;
Misc cleanup:
- KNF
- WARNSfy
- remove __P()
- remove register declarations
- const'ify some variables
- make some local functions/variables static
- bcopy -> memcpy
- bcmp -> memcmp
- bzero -> memset
- space/TAB fix
etc.
 1.3 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.2 12-May-1997  thorpej branches: 1.2.56;
- Add glue for standalone APCI console driver.
- Make the romputchar() useage conditional only on "userom".
 1.1 04-Feb-1997  thorpej Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.2.56.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.2.56.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.56.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.56.1 03-Aug-2004  skrll Sync with HEAD
 1.4.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.4.8.1 29-Apr-2005  kent sync with -current
 1.6.108.1 17-Feb-2011  bouyer Sync with HEAD
 1.6.106.1 06-Jun-2011  jruoho Sync with HEAD.
 1.6.100.1 05-Mar-2011  rmind sync with head
 1.5 11-Dec-2005  christos merge ktrace-lwp.
 1.4 14-Nov-2003  tsutsui Misc cleanup:
- KNF
- WARNSfy
- remove __P()
- remove register declarations
- const'ify some variables
- make some local functions/variables static
- bcopy -> memcpy
- bcmp -> memcmp
- bzero -> memset
- space/TAB fix
etc.
 1.3 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.2 12-May-1997  thorpej branches: 1.2.56;
Add prototypes for standalone APCI driver.
 1.1 04-Feb-1997  thorpej Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.2.56.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.56.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.56.1 03-Aug-2004  skrll Sync with HEAD
 1.8 05-Jul-2021  tsutsui Cleanup duplicated CS/80 indentify structures. From OpenBSD.

https://marc.info/?l=openbsd-cvs&m=113227249626888&w=2
> Define the CS/80 identify structure only once and correctly, instead of
> duplicating it in every CS/80 driver and using an hardcoded number for
> its size.
> No functional change.

https://marc.info/?l=openbsd-cvs&m=113273001020159&w=2
> Pick HP-IB describe structures changes from main kernel code here as well.
 1.7 17-Jul-2011  joerg branches: 1.7.58; 1.7.70;
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.6 25-Jun-2006  tsutsui Use (uint8_t *) to specify buffers for hpib xfers.
 1.5 11-Dec-2005  christos branches: 1.5.4; 1.5.8; 1.5.16;
merge ktrace-lwp.
 1.4 20-Feb-2005  tsutsui branches: 1.4.4;
Use ANSI function decls.
 1.3 14-Nov-2003  tsutsui branches: 1.3.8; 1.3.10;
Misc cleanup:
- KNF
- WARNSfy
- remove __P()
- remove register declarations
- const'ify some variables
- make some local functions/variables static
- bcopy -> memcpy
- bcmp -> memcmp
- bzero -> memset
- space/TAB fix
etc.
 1.2 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.1 04-Feb-1997  thorpej branches: 1.1.60;
Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.1.60.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.1.60.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.60.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.60.1 03-Aug-2004  skrll Sync with HEAD
 1.3.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.3.8.1 29-Apr-2005  kent sync with -current
 1.4.4.1 30-Dec-2006  yamt sync with head.
 1.5.16.1 13-Jul-2006  gdamore Merge from HEAD.
 1.5.8.1 26-Jun-2006  yamt sync with head.
 1.5.4.1 09-Sep-2006  rpaulo sync with head
 1.7.70.1 01-Aug-2021  thorpej Sync with HEAD.
 1.7.58.1 14-Jul-2021  martin Pull up following revision(s) (requested by tsutsui in ticket #1323):

sys/arch/hp300/dev/rd.c: revision 1.109
sys/arch/hp300/stand/Makefile.buildboot: revision 1.37
sys/arch/hp300/stand/common/ct.c: revision 1.8
sys/arch/hp300/dev/hpibvar.h: revision 1.22
sys/arch/hp300/dev/ct.c: revision 1.62
sys/arch/hp300/dev/hpibvar.h: revision 1.23
sys/arch/hp300/dev/ct.c: revision 1.63
sys/arch/hp300/dev/hpibvar.h: revision 1.24
sys/arch/hp300/dev/mt.c: revision 1.55
sys/arch/hp300/dev/rdreg.h: revision 1.14
sys/arch/hp300/dev/hpib.c: revision 1.43 (via patch)
sys/arch/hp300/dev/rdreg.h: revision 1.15
sys/arch/hp300/dev/rdreg.h: revision 1.16
sys/arch/hp300/dev/rdreg.h: revision 1.17
etc/etc.hp300/MAKEDEV.conf: revision 1.15
sys/arch/hp300/stand/common/hpibvar.h: revision 1.6
sys/arch/hp300/stand/common/rd.c: revision 1.11
sys/arch/hp300/dev/ctreg.h: revision 1.11
sys/arch/hp300/dev/rdvar.h: revision 1.24
sys/arch/hp300/dev/rdvar.h: revision 1.25
sys/arch/hp300/dev/rdvar.h: revision 1.26
sys/arch/hp300/dev/rd.c: revision 1.103
sys/arch/hp300/dev/rd.c: revision 1.104
sys/arch/hp300/dev/rd.c: revision 1.105
sys/arch/hp300/dev/rd.c: revision 1.106
sys/arch/hp300/dev/rd.c: revision 1.107
sys/arch/hp300/dev/rd.c: revision 1.108

Consistently use #define<tab> here.

Consistently use #define<tab> as rdreg.h.

No need to bother to use aprint_debug(9) inside #ifdef DEBUG block.

Pull HP-IB probe fixes from OpenBSD/hp300.
https://marc.info/?l=openbsd-cvs&m=113217630426615&w=2

Overhaul the way HP-IB devices are probed. We will now do an exhaustive
probe of the (slave, punit) tuple space, since this is the only way we
can get a dual disk or dual tape enclosure to attach two devices of the
same kind.

This allows using multiple rd(4) disk images on the same slave emulated
by HPDisk (and probably the real 9122D with dual floppy disk drives).

Thanks to Miod Vallat for suggesting this fix.

Move attach messages from common rdident() to explicit rdattach().

Cleanup duplicated CS/80 indentify structures. From OpenBSD.
https://marc.info/?l=openbsd-cvs&m=113227249626888&w=2

Define the CS/80 identify structure only once and correctly, instead of
duplicating it in every CS/80 driver and using an hardcoded number for
its size.
No functional change.
https://marc.info/?l=openbsd-cvs&m=113273001020159&w=2

Pick HP-IB describe structures changes from main kernel code here as well.

Add support of multiple rd(4) disks on all punits for HPDisk.

Special thanks to Anders Gustafsson, the author of "HPDisk"
(GPIB disk emulator) http://www.dalton.ax/hpdisk/
for providing bare boards and improving firmwares for NetBSD/hp300.

Specify -fno-unwind-tables to shrink binaries.

Before:
text data bss dec hex filename
77902 4328 137120 219350 358d6 uboot

After:
text data bss dec hex filename
64186 4328 137120 205634 32342 uboot

Create rd3 device nodes, for HPDisk.

Add Device and drive info of 2202A, 7908A, 7911A, and 7941A.

Geometries and description info are taken from hpdrive.ini.sample
in HPDrive. Briefly tested on HPDisk.

Print rd(4) capacity and geometry info as sd(4) and wd(4) do.

Before:
rd0 at hpibbus1 slave 0 punit 0: 7937H
rd0: 698 cylinders, 13 heads, 1116102 blocks, 512 bytes/block

After:
rd0 at hpibbus1 slave 0 punit 0: 7937H
rd0: 544 MB, 698 cyl, 13 head, 123 sec, 512 bytes/block x 1116102 blocks
 1.8 21-Apr-2023  tsutsui Remove ancient /* ARGSUSED */ lint comments.
 1.7 08-Feb-2011  rmind Remove clause 3 (UCB advertising clause) from the University of Utah
copyright. Confirmed by Mike Hibler, mike at cs.utah.edu - thanks!
Also, merge UCB and Utah copyright texts back into one, as they
originally were.

Extra verification by snj@.
 1.6 11-Dec-2005  christos branches: 1.6.100; 1.6.106; 1.6.108;
merge ktrace-lwp.
 1.5 20-Feb-2005  tsutsui Use ANSI function decls.
 1.4 14-Nov-2003  tsutsui branches: 1.4.8; 1.4.10;
Misc cleanup:
- KNF
- WARNSfy
- remove __P()
- remove register declarations
- const'ify some variables
- make some local functions/variables static
- bcopy -> memcpy
- bcmp -> memcmp
- bzero -> memset
- space/TAB fix
etc.
 1.3 08-Nov-2003  tsutsui Adapt to replacement of apcireg.h and dcareg.h.
 1.2 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.1 04-Feb-1997  thorpej branches: 1.1.60;
Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.1.60.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.1.60.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.60.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.60.1 03-Aug-2004  skrll Sync with HEAD
 1.4.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.4.8.1 29-Apr-2005  kent sync with -current
 1.6.108.1 17-Feb-2011  bouyer Sync with HEAD
 1.6.106.1 06-Jun-2011  jruoho Sync with HEAD.
 1.6.100.1 05-Mar-2011  rmind sync with head
 1.2 11-Dec-2005  christos merge ktrace-lwp.
 1.1 08-Nov-2003  tsutsui branches: 1.1.4;
Move apcireg.h and dcareg.h to stand/common since they are no longer used
by kernel.
 1.1.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.1.4.2 03-Aug-2004  skrll Sync with HEAD
 1.1.4.1 08-Nov-2003  skrll file dcareg.h was added on branch ktrace-lwp on 2004-08-03 10:34:37 +0000
 1.10 21-Apr-2023  tsutsui Remove ancient /* ARGSUSED */ lint comments.
 1.9 21-Jun-2014  tsutsui Appease gcc48 -Wunused-but-set-variable warnings.
 1.8 08-Feb-2011  rmind branches: 1.8.14; 1.8.28;
Remove clause 3 (UCB advertising clause) from the University of Utah
copyright. Confirmed by Mike Hibler, mike at cs.utah.edu - thanks!
Also, merge UCB and Utah copyright texts back into one, as they
originally were.

Extra verification by snj@.
 1.7 04-Mar-2007  christos branches: 1.7.66; 1.7.72; 1.7.74;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.6 11-Dec-2005  christos branches: 1.6.26;
merge ktrace-lwp.
 1.5 20-Feb-2005  tsutsui branches: 1.5.4;
Use ANSI function decls.
 1.4 14-Nov-2003  tsutsui branches: 1.4.8; 1.4.10;
Misc cleanup:
- KNF
- WARNSfy
- remove __P()
- remove register declarations
- const'ify some variables
- make some local functions/variables static
- bcopy -> memcpy
- bcmp -> memcmp
- bzero -> memset
- space/TAB fix
etc.
 1.3 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.2 14-Apr-1997  scottr branches: 1.2.56;
Allowing forcing console on dcm with FORCEDCMCONSOLE (c.f. dca.c).
 1.1 04-Feb-1997  thorpej Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.2.56.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.2.56.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.56.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.56.1 03-Aug-2004  skrll Sync with HEAD
 1.4.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.4.8.1 29-Apr-2005  kent sync with -current
 1.5.4.1 03-Sep-2007  yamt sync with head.
 1.6.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.7.74.1 17-Feb-2011  bouyer Sync with HEAD
 1.7.72.1 06-Jun-2011  jruoho Sync with HEAD.
 1.7.66.1 05-Mar-2011  rmind sync with head
 1.8.28.1 10-Aug-2014  tls Rebase.
 1.8.14.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.5 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.4 25-Jun-2006  tsutsui branches: 1.4.10;
- move declaration for sc_table from samachdep.h to device.h
- include <lib/libsa/stand.h> from samachdep.h for struct fs_ops
- remove unneeded declarations from samachdep.h
 1.3 11-Dec-2005  christos branches: 1.3.4; 1.3.8; 1.3.16;
merge ktrace-lwp.
 1.2 07-Aug-2003  agc branches: 1.2.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.1 04-Feb-1997  thorpej branches: 1.1.60;
Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.1.60.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.60.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.60.1 03-Aug-2004  skrll Sync with HEAD
 1.2.16.2 03-Sep-2007  yamt sync with head.
 1.2.16.1 30-Dec-2006  yamt sync with head.
 1.3.16.1 13-Jul-2006  gdamore Merge from HEAD.
 1.3.8.1 26-Jun-2006  yamt sync with head.
 1.3.4.1 09-Sep-2006  rpaulo sync with head
 1.4.10.1 12-Mar-2007  rmind Sync with HEAD.
 1.15 09-May-2024  tsutsui Add a preliminary CD boot support to uboot for preparation of PR/54455.

Briefly tested on mame, but not enalbed yet.
 1.14 15-Jan-2023  tsutsui TAB/space cleanup.
 1.13 11-Dec-2022  tsutsui branches: 1.13.2;
Make hp300 bootloaders UFS2 ready.
 1.12 08-Mar-2018  mrg fix various gcc6 m68k issues:
- bad indentation. next68k en.c and mvme68k le_poll.c fixes real issues
in error handling, the rest are NFCI.
- pass 68030 flags as appropriate for mvme68k.
- next68k nextrom.c has -Warray-bounds ignored for an odd expression
that appears to run before relocation, and needs manual offsets
added which trips bounds array checking.

with this all m68k ports build with GCC 6.
 1.11 10-Aug-2014  isaki branches: 1.11.26;
Unify all arch/*/stand's atoi() to MI libsa.
lib/libsa/atoi.c was separated from lib/libsa/bootcfg.c.
PR/49084
 1.10 28-Apr-2008  martin branches: 1.10.44;
Remove clause 3 and 4 from TNF licenses
 1.9 11-Dec-2005  christos branches: 1.9.74; 1.9.76; 1.9.78;
merge ktrace-lwp.
 1.8 17-Apr-2005  christos PR/21170: Christian Biere: ctype function misuse.
 1.7 20-Feb-2005  tsutsui Use ANSI function decls.
 1.6 14-Nov-2003  tsutsui branches: 1.6.8; 1.6.10;
Misc cleanup:
- KNF
- WARNSfy
- remove __P()
- remove register declarations
- const'ify some variables
- make some local functions/variables static
- bcopy -> memcpy
- bcmp -> memcmp
- bzero -> memset
- space/TAB fix
etc.
 1.5 13-Nov-2003  tsutsui Backout part of rev 1.4 which caused uninitialized pointer dereference.
(How does it works!?)
 1.4 04-Aug-2002  gmcgarry branches: 1.4.6;
Boot loader is now case sensitive. Fixes PR-17711.
 1.3 13-May-2001  gmcgarry branches: 1.3.2; 1.3.8; 1.3.16;
pull in lib/libkern/libkern.h to resolve inline tolower()
 1.2 04-Oct-1997  thorpej branches: 1.2.28;
Copyright assigned to The NetBSD Foundation.
 1.1 04-Feb-1997  thorpej branches: 1.1.8;
Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.1.8.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.2.28.1 21-Jun-2001  nathanw Catch up to -current.
 1.3.16.1 30-Aug-2002  gehenna catch up with -current.
 1.3.8.2 13-Aug-2002  nathanw Catch up to -current.
 1.3.8.1 13-May-2001  nathanw file devopen.c was added on branch nathanw_sa on 2002-08-13 02:18:12 +0000
 1.3.2.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.4.6.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.4.6.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.4.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.4.6.1 03-Aug-2004  skrll Sync with HEAD
 1.6.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.6.8.1 29-Apr-2005  kent sync with -current
 1.9.78.1 16-May-2008  yamt sync with head.
 1.9.76.1 18-May-2008  yamt sync with head.
 1.9.74.1 02-Jun-2008  mjf Sync with HEAD.
 1.10.44.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.11.26.1 15-Mar-2018  pgoyette Synch with HEAD
 1.13.2.1 22-Jun-2024  martin Pull up following revision(s) (requested by tsutsui in ticket #722):

sys/fs/cd9660/cd9660_util.c: revision 1.16
sys/arch/hp300/stand/common/clock.c: revision 1.14
sys/arch/hp300/stand/common/scsireg.h: revision 1.5
sys/arch/hp300/stand/common/scsireg.h: revision 1.6
sys/arch/hp300/stand/Makefile.buildboot: revision 1.38
sys/arch/hp300/include/bus.h: revision 1.23
sys/arch/hp300/stand/Makefile.buildboot: revision 1.39
sys/arch/hp300/stand/common/sd.c: revision 1.12
sys/arch/hp300/stand/common/prf.c: revision 1.6
sys/arch/hp300/stand/common/sd.c: revision 1.13
usr.sbin/installboot/installboot.8: revision 1.106
usr.sbin/installboot/Makefile: revision 1.59
sys/arch/hp300/stand/common/devopen.c: revision 1.14
usr.sbin/installboot/installboot.8: revision 1.107
sys/arch/hp300/stand/common/ite_dumb.c: revision 1.2
sys/arch/hp300/stand/common/devopen.c: revision 1.15
usr.sbin/installboot/installboot.8: revision 1.108
sys/fs/cd9660/cd9660_extern.h: revision 1.29
usr.sbin/installboot/installboot.8: revision 1.109
tools/Makefile.nbincludes: revision 1.11 (patch)
sys/arch/hp300/dev/rboxreg.h: revision 1.3
sys/arch/hp300/stand/common/scsivar.h: revision 1.5
sys/arch/hp300/dev/dnkbd.c: revision 1.14
sys/arch/hp300/hp300/trap.c: revision 1.156
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.12
sys/arch/hp300/dev/frodoreg.h: revision 1.6
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.13
sys/arch/hp300/stand/common/ite_sti.c: revision 1.2
sys/arch/hp300/stand/common/hil.c: revision 1.15
usr.sbin/installboot/arch/hp300.c: revision 1.18
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.14
sys/arch/hp300/dev/rbox.c: revision 1.4
usr.sbin/installboot/arch/hp300.c: revision 1.19
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.15
sys/sys/bootblock.h: revision 1.59
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.16
usr.sbin/installboot/installboot.h: revision 1.44
sys/arch/hp300/stand/mkboot/volhdr.h: file removal
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.17
sys/arch/hp300/dev/hpib.c: revision 1.45
usr.sbin/installboot/installboot.h: revision 1.45
usr.sbin/installboot/cd9660.c: revision 1.1
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.18
sys/arch/hp300/dev/topcatreg.h: revision 1.3
usr.sbin/installboot/cd9660.c: revision 1.2
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.19
sys/arch/hp300/stand/inst/inst.c: revision 1.25
sys/arch/hp300/stand/uboot/Makefile: revision 1.12
sys/arch/hp300/dev/dvbox.c: revision 1.4
sys/arch/hp300/dev/dma.c: revision 1.45
sys/arch/hp300/stand/uboot/Makefile: revision 1.13
sys/arch/hp300/stand/common/rd.c: revision 1.16
sys/arch/hp300/stand/inst/Makefile: revision 1.12
distrib/hp300/cdroms/installcd/Makefile: revision 1.4
sys/arch/hp300/stand/mkboot/volhdr.h: revision 1.6
sys/arch/hp300/stand/common/machdep.c: revision 1.16
usr.sbin/installboot/fstypes.c: revision 1.14
sys/arch/hp300/hp300/machdep.c: revision 1.238
sys/arch/hp300/include/cpu.h: revision 1.73
sys/arch/hp300/dev/diofbreg.h: revision 1.4
sys/arch/hp300/stand/common/scsi.c: revision 1.12
sys/arch/hp300/stand/common/netio.c: revision 1.19
sys/arch/hp300/stand/common/scsi.c: revision 1.13
sys/arch/hp300/dev/sti_sgc.c: revision 1.8
sys/arch/hp300/dev/rtc.c: revision 1.22
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.20
sys/arch/hp300/stand/common/conf.h: revision 1.4
sys/arch/hp300/hp300/autoconf.c: revision 1.111
sys/arch/hp300/stand/common/conf.c: revision 1.15
sys/arch/hp300/stand/mkboot/Makefile: revision 1.12
sys/arch/hp300/stand/mkboot/Makefile: revision 1.13
sys/arch/hp300/hp300/autoconf.c: revision 1.114
sys/arch/hp300/dev/dcmreg.h: revision 1.11
sys/arch/hp300/dev/diofbvar.h: revision 1.4
sys/arch/hp300/dev/dcm.c: revision 1.91
sys/fs/cd9660/cd9660_util.c: revision 1.15
sys/arch/hp300/dev/mcclock_frodo.c: revision 1.2

TAB/space cleanup.

installboot(8): formatting improvements

Use Ar foo instead of <foo>; this is mdoc.

Other formatting tweaks.
installboot(8): fix up markup

Don't overuse .Sy - when everything is highlighted, nothing is. Use
.Ic for options &c to get correct PostScript output (both are bold in
plain text).

Use Aq Ar inside .Pa, as both Pa and Ar are rendered as underscored
text in plain text output, and the distinction is lost.

Don't set examples in bold, but give them .Pp space around - they are
much easier to read this way.

Use consistent -width in FILES.
document how to use installboot on netbsd/vax.

PR/57909: Jan-Benedict Glaw: Don't include (build) timestamp when doing a
reproducible build
fix usage string, improve error handling.
add missing chunk for repro-build. fix gcc warnings.
avoid stringop truncation, fix copyright string to prevent assembler warnings.

Fix build as a tool (Jan-Benedict Glaw)

Fix integer overflow of strtol(3) for "loadpoint" address on ILP32 hosts.

This strtol(3) was introduced in rev 1.12 for PR/57909 after netbsd-10,
but it returns LONG_MAX (0x7FFFFFFF) for 0xFFF00000 on ILP32 hosts and
the wrong loadpoint causes "NOT ENOUGH MEMORY" error by the BOOTROMs
on loading uboot.lif on (at least) my 9000/360 and 9000/425t.

Misc cosmetic changes for mostly readability.
- KNF and add some newlines per blocks
- define and use proper bintobcd() macro
- make local functions and variables static

The same uboot.lif binaries are generated.

Rename ${PROGAOUT} -> ${PROGELF} to reflect reality.
Use proper signedness for the LIF file system data structures.

Ancient 4.3BSD used short and int for location, file size, file type,
and addresses etc. but all of them should be unsigned.

Also rename several variables and add comments for readability.
The LIF file system info can be found in "The HPDir Project" page:
https://www.hp9845.net/9845/projects/hpdir/
The same uboot.lif binaries are generated.

Add a preliminary CD boot support to uboot for preparation of PR/54455.
Briefly tested on mame, but not enalbed yet.

Recognize SCSI CD-ROM devices as a booted device properly.

Necessary for PR port-hp300/54455, to boot an md root root RAMDISK

kernel from CD-ROM without "WARNING: can't find match for bootdev:"
prompt.

Sync with src/sys/arch/hp300/stand/mkboot/volhdr.h rev 1.6.
https://mail-index.netbsd.org/source-changes/2024/05/07/msg151195.html

Use proper signedness for the LIF file system data structures.
mkboot should use this MI <sys/bootblock.h> and volhdr.h should
be removed soon.

Use MI <sys/bootblock.h> to refer LIF filesystem structures.
This should have been done when LIF definitions were initially added
to <sys/bootblock.h> for MI installboot(8).

Enable SUPPORT_CD on uboot.

Make cd9660_util.c usable in userland tools like installboot(8).

This was partially done for src/distrib/cdrom/macppc_installboot,
but more strict prototypes are necessary for native binary builds.

Install cd9660 related system headers for tools installboot(8) builds.

Reorder function prototypes per source files.

Add cd9660 support to search a bootloader file in the target file system.

Also add CD boot support for hp300, using a bootloader file in cd9660 fs.
This is a tool's part to close PR/54455.

HP 9000/300 machines read LIF directory entry allocated after
the LIF volume header at the top of the boot disk during bootstrap,
and a bootstrap file must be contiguously allocated on the disk
due to limitation of the LIF specification.

Current NetBSD/hp300's bootloader is larger than ~80KB so we have
to prepare a special 'boot' partition for FFS (that has only 8KB (ffsv1)
or 32KB (ffsv2) spaces) disks to put such a large bootloader.

On the other hand, on ISO9660 fs all files are allocated contiguously
so we can specify a bootloader file in the target ISO9660 directly
in the LIF directory entry.

Note we can simply use the existing "append" option to create bootable
CD ISO for hp300, but it looks some emulators (at leaset MAME) reject
such non-standard ISO files, i.e. with an appended bootloader file at
the end of the image.

Put a RAMDISK kernel and SYS_UBOOT into hp300 installcd to make it bootable.

This should finally close PR/54455.

Fix tools build errors on Cygwin.

Appease warnings on building tools/installboot on Cygwin.
 1.13 22-Apr-2014  tsutsui Also fix the apci device address in dnkbd.c as apci.c rev 1.12:

http://mail-index.netbsd.org/source-changes/2014/04/10/msg053940.html

Finally dnkbd(4) is confirmed working at least on bootloader.
Thanks again to Miod Vallat.
 1.12 28-Apr-2008  martin branches: 1.12.34; 1.12.40; 1.12.44; 1.12.50; 1.12.60;
Remove clause 3 and 4 from TNF licenses
 1.11 04-Mar-2007  christos branches: 1.11.40; 1.11.42; 1.11.44;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.10 19-Jul-2006  tsutsui branches: 1.10.10;
Adapt stand sources to changes of intio device offset macro.
 1.9 11-Dec-2005  christos branches: 1.9.4; 1.9.8;
merge ktrace-lwp.
 1.8 20-Feb-2005  tsutsui branches: 1.8.4;
Use ANSI function decls.
 1.7 14-Nov-2003  tsutsui branches: 1.7.8; 1.7.10;
Misc cleanup:
- KNF
- WARNSfy
- remove __P()
- remove register declarations
- const'ify some variables
- make some local functions/variables static
- bcopy -> memcpy
- bcmp -> memcmp
- bzero -> memset
- space/TAB fix
etc.
 1.6 08-Nov-2003  tsutsui Adapt to replacement of apcireg.h and dcareg.h.
 1.5 29-Sep-2002  wiz branches: 1.5.6;
"definitions" has lots of 'i's, but that's not reason to leave one out.
 1.4 09-Oct-1997  jtc branches: 1.4.30; 1.4.34;
Fix tipo inherited from old version of TNF copyright template.
 1.3 12-May-1997  thorpej branches: 1.3.4;
Don't use a hard-coded hex address for the 0'th APCI port; use definitions
from <hp300/dev/frodoreg.h>
 1.2 27-Apr-1997  thorpej Don't even look for a Domain keyboard if we're not a 400, 425, or 433.
 1.1 14-Apr-1997  thorpej Add support for the Apollo Domain keyboard, from mike smith
<miff@spam.frisbee.net.au> with some changes for integration by me.
 1.3.4.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.4.34.1 18-Oct-2002  nathanw Catch up to -current.
 1.4.30.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.5.6.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.5.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.5.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.5.6.1 03-Aug-2004  skrll Sync with HEAD
 1.7.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.7.8.1 29-Apr-2005  kent sync with -current
 1.8.4.2 03-Sep-2007  yamt sync with head.
 1.8.4.1 30-Dec-2006  yamt sync with head.
 1.9.8.1 11-Aug-2006  yamt sync with head
 1.9.4.1 09-Sep-2006  rpaulo sync with head
 1.10.10.1 12-Mar-2007  rmind Sync with HEAD.
 1.11.44.1 16-May-2008  yamt sync with head.
 1.11.42.1 18-May-2008  yamt sync with head.
 1.11.40.1 02-Jun-2008  mjf Sync with HEAD.
 1.12.60.1 10-Aug-2014  tls Rebase.
 1.12.50.1 18-May-2014  rmind sync with head
 1.12.44.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.12.40.1 21-May-2014  bouyer Pull up following revision(s) (requested by tsutsui in ticket #1058):
sys/arch/hp300/conf/files.hp300: revision 1.88
sys/arch/hp300/include/autoconf.h: revision 1.13
sys/dev/ic/sti.c: revision 1.17
sys/arch/hp300/dev/frodo.c: revision 1.31
sys/arch/hp300/conf/GENERIC: revision 1.173
sys/arch/hp300/hp300/machdep.c: revision 1.229
sys/arch/hp300/dev/frodo.c: revision 1.32
sys/arch/hp300/hp300/autoconf.c: revision 1.102
sys/arch/hp300/dev/frodoreg.h: revision 1.5
sys/arch/hp300/stand/common/ite_sti.c: revision 1.1
sys/arch/hp300/stand/common/itevar.h: revision 1.16
sys/arch/hp300/hp300/autoconf.c: revision 1.105
sys/arch/hp300/dev/sti_sgcvar.h: revision 1.1
sys/arch/hp300/stand/common/apci.c: revision 1.12
sys/arch/hp300/stand/common/apci.c: revision 1.13
sys/arch/hp300/dev/dnkbd.c: revision 1.6
sys/arch/hp300/dev/dnkbd.c: revision 1.7
sys/arch/hp300/stand/inst/version: revision 1.12
sys/arch/hp300/dev/com_frodo.c: revision 1.9
sys/arch/hp300/stand/common/ite.c: revision 1.17
sys/arch/hp300/conf/GENERIC: revision 1.181
sys/arch/hp300/dev/sti_sgc.c: revision 1.1
sys/arch/hp300/stand/common/dnkbd.c: revision 1.13
sys/arch/hp300/dev/sti_sgc.c: revision 1.2
sys/dev/ic/stivar.h: revision 1.8
sys/arch/hp300/dev/rtc.c: revision 1.21
sys/arch/hp300/conf/INSTALL: revision 1.56
sys/arch/hp300/conf/INSTALL: revision 1.58
sys/arch/hp300/stand/uboot/version: revision 1.19
sys/arch/hp300/stand/common/samachdep.h: revision 1.17
sys/arch/hp300/stand/common/clock.c: revision 1.12
sys/arch/hp300/dev/mcclock_frodo.c: revision 1.1
sys/arch/hp300/stand/Makefile.buildboot: revision 1.34
sys/arch/hp300/conf/files.hp300: revision 1.87
Add sti at sgc framebuffer.
Ported from OpenBSD by kiyohara@.
Fix a botch on switching from apci (and dca) to MI com(4) 10 years ago.
I.e. fix apci device address per FRODO_BASE macro change
in frodoreg.h rev 1.2. Now bootloader works with serial console
on HP425e (which has only com at frodo).
Thanks to miod@openbsd for providing his 425e.
Add sti(4) at sgc screen console support. From (the late) OpenBSD/hp300.
Tested on HP9000/425e, which was sent from Miod Vallat and
demonstrated at Open Source unConference 2014 Kagawa.
Check the service switch on 425e to select apci serial console.
Taken from OpenBSD/hp300. See the following comment for details:
> * Check the service switch. On the 425e, this is a physical
> * switch, unlike other frodo-based machines, so we can use it
> * as a serial vs internal video selector, since the PROM can not
> * be configured for serial console.
Add proper RealTime Clock support for HP9000/425e.
As the OpenBSD/hp300 page says 425e doesn't have the traditional
RTC at intio (as it also lacks DCA 16550 serial at intio?),
but after a few hour investigation it turns out that
425e uses mc146818 compatible calendar clock in
the Apollo "frodo" utility chip and the frodo chip on
425e actually has the 32kHz OSC and is actually backed up
by the onboard lithium battery.
Tested on HP425e (with mcclock) and HP362 (with old rtc).
Add RTC support for HP9000/425e to bootloader too.
Also put several cleanup:
- make local functions and variables static
- use proper variable types
- some KNF
Note it turns out that extreme slowness of netboot on hp300 is
caused by the too slow access of the traditional RTC chip at intio
(i.e. netboot on 425e is so much faster than others). Oh well.
Add proper consinit(9) support for sti(4) at sgc framebuffer on hp300.
The cnattach functions for sti(4) and service switch check method
for 425e in com_frodo.c are taken from OpenBSD.
The strategy how to choose the console device in hp300_cninit() is
quite diverged from 4.4BSD and OpenBSD so it's tweaked by me.
Also put several changes in sti_sgc.c to reduce diffs from OpenBSD/hp300.
Tested on 425e and 362 (which still uses gendiofb(4), not sti(4)).
XXX: sti(4) requires uvm_km_alloc(9) and uvm_map_protect(9)
to copy and call ROM functions on the executable memory region, so
it can be called before UVM and related initializations are complete.
Probably it's time to consider about MI "deferred consinit()" API
in init_main.c (or elsewhere) for modern complicated VM system...
Also fix the apci device address in dnkbd.c as apci.c rev 1.12:
http://mail-index.netbsd.org/source-changes/2014/04/10/msg053940.html
Finally dnkbd(4) is confirmed working at least on bootloader.
Thanks again to Miod Vallat.
Make the Apollo Domain keyboard actually work.
Tested on HP9000/425e and the keyboard model A1630-82001 R2 (RX-60857-HW)
provided by Miod Vallat. Mouse support needs more work.
Pull random notes on the Apollo Domain keyboard from ancient PR/3528.
Bump versions to denote recent 425e related changes.
Probe mcclock only on 425e to avoid an extra "not configured" message.
Add and enable sti(4) at sgc in install kernels for 425e.
Tested on both serial console and framebuffer console.
(switched by the service switch on the back panel)
 1.12.34.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.5 11-Dec-2005  christos merge ktrace-lwp.
 1.4 20-Feb-2005  tsutsui Use ANSI function decls.
 1.3 14-Nov-2003  tsutsui branches: 1.3.8; 1.3.10;
Misc cleanup:
- KNF
- WARNSfy
- remove __P()
- remove register declarations
- const'ify some variables
- make some local functions/variables static
- bcopy -> memcpy
- bcmp -> memcmp
- bzero -> memset
- space/TAB fix
etc.
 1.2 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.1 16-Mar-2002  gmcgarry branches: 1.1.4; 1.1.10; 1.1.16;
Move exec_hp300() out of uboot.c into its own file so that it can
be used by SYS_INST. SYS_INST can now boot ELF kernels inside the
miniroot.
 1.1.16.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.1.16.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.16.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.16.1 03-Aug-2004  skrll Sync with HEAD
 1.1.10.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.10.1 16-Mar-2002  jdolecek file exec.c was added on branch kqueue on 2002-06-23 17:36:15 +0000
 1.1.4.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.1.4.1 16-Mar-2002  nathanw file exec.c was added on branch nathanw_sa on 2002-04-01 07:39:59 +0000
 1.3.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.3.8.1 29-Apr-2005  kent sync with -current
 1.6 25-Jun-2006  tsutsui Use (uint8_t *) to specify buffers for hpib xfers.
 1.5 11-Dec-2005  christos branches: 1.5.4; 1.5.8; 1.5.16;
merge ktrace-lwp.
 1.4 20-Feb-2005  tsutsui branches: 1.4.4;
Use ANSI function decls.
 1.3 14-Nov-2003  tsutsui branches: 1.3.8; 1.3.10;
Misc cleanup:
- KNF
- WARNSfy
- remove __P()
- remove register declarations
- const'ify some variables
- make some local functions/variables static
- bcopy -> memcpy
- bcmp -> memcmp
- bzero -> memset
- space/TAB fix
etc.
 1.2 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.1 04-Feb-1997  thorpej branches: 1.1.60;
Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.1.60.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.1.60.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.60.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.60.1 03-Aug-2004  skrll Sync with HEAD
 1.3.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.3.8.1 29-Apr-2005  kent sync with -current
 1.4.4.1 30-Dec-2006  yamt sync with head.
 1.5.16.1 13-Jul-2006  gdamore Merge from HEAD.
 1.5.8.1 26-Jun-2006  yamt sync with head.
 1.5.4.1 09-Sep-2006  rpaulo sync with head
 1.2 08-Feb-2011  rmind branches: 1.2.2; 1.2.6;
Remove clause 3 (UCB advertising clause) from the University of Utah
copyright. Confirmed by Mike Hibler, mike at cs.utah.edu - thanks!
Also, merge UCB and Utah copyright texts back into one, as they
originally were.

Extra verification by snj@.
 1.1 07-Feb-2011  tsutsui branches: 1.1.2;
Resurrect and move retired ITE files that are still used by bootloaders.
 1.1.2.3 17-Feb-2011  bouyer Sync with HEAD
 1.1.2.2 08-Feb-2011  bouyer Sync with HEAD
 1.1.2.1 07-Feb-2011  bouyer file grf_dvreg.h was added on branch bouyer-quota2 on 2011-02-08 16:19:22 +0000
 1.2.6.2 06-Jun-2011  jruoho Sync with HEAD.
 1.2.6.1 08-Feb-2011  jruoho file grf_dvreg.h was added on branch jruoho-x86intr on 2011-06-06 09:05:38 +0000
 1.2.2.2 05-Mar-2011  rmind sync with head
 1.2.2.1 08-Feb-2011  rmind file grf_dvreg.h was added on branch rmind-uvmplock on 2011-03-05 20:50:25 +0000
 1.2 08-Feb-2011  rmind branches: 1.2.2; 1.2.6;
Remove clause 3 (UCB advertising clause) from the University of Utah
copyright. Confirmed by Mike Hibler, mike at cs.utah.edu - thanks!
Also, merge UCB and Utah copyright texts back into one, as they
originally were.

Extra verification by snj@.
 1.1 07-Feb-2011  tsutsui branches: 1.1.2;
Resurrect and move retired ITE files that are still used by bootloaders.
 1.1.2.3 17-Feb-2011  bouyer Sync with HEAD
 1.1.2.2 08-Feb-2011  bouyer Sync with HEAD
 1.1.2.1 07-Feb-2011  bouyer file grf_gbreg.h was added on branch bouyer-quota2 on 2011-02-08 16:19:22 +0000
 1.2.6.2 06-Jun-2011  jruoho Sync with HEAD.
 1.2.6.1 08-Feb-2011  jruoho file grf_gbreg.h was added on branch jruoho-x86intr on 2011-06-06 09:05:38 +0000
 1.2.2.2 05-Mar-2011  rmind sync with head
 1.2.2.1 08-Feb-2011  rmind file grf_gbreg.h was added on branch rmind-uvmplock on 2011-03-05 20:50:25 +0000
 1.2 08-Feb-2011  rmind branches: 1.2.2; 1.2.6;
Remove clause 3 (UCB advertising clause) from the University of Utah
copyright. Confirmed by Mike Hibler, mike at cs.utah.edu - thanks!
Also, merge UCB and Utah copyright texts back into one, as they
originally were.

Extra verification by snj@.
 1.1 07-Feb-2011  tsutsui branches: 1.1.2;
Resurrect and move retired ITE files that are still used by bootloaders.
 1.1.2.3 17-Feb-2011  bouyer Sync with HEAD
 1.1.2.2 08-Feb-2011  bouyer Sync with HEAD
 1.1.2.1 07-Feb-2011  bouyer file grf_hyreg.h was added on branch bouyer-quota2 on 2011-02-08 16:19:22 +0000
 1.2.6.2 06-Jun-2011  jruoho Sync with HEAD.
 1.2.6.1 08-Feb-2011  jruoho file grf_hyreg.h was added on branch jruoho-x86intr on 2011-06-06 09:05:38 +0000
 1.2.2.2 05-Mar-2011  rmind sync with head
 1.2.2.1 08-Feb-2011  rmind file grf_hyreg.h was added on branch rmind-uvmplock on 2011-03-05 20:50:25 +0000
 1.2 08-Feb-2011  rmind branches: 1.2.2; 1.2.6;
Remove clause 3 (UCB advertising clause) from the University of Utah
copyright. Confirmed by Mike Hibler, mike at cs.utah.edu - thanks!
Also, merge UCB and Utah copyright texts back into one, as they
originally were.

Extra verification by snj@.
 1.1 07-Feb-2011  tsutsui branches: 1.1.2;
Resurrect and move retired ITE files that are still used by bootloaders.
 1.1.2.3 17-Feb-2011  bouyer Sync with HEAD
 1.1.2.2 08-Feb-2011  bouyer Sync with HEAD
 1.1.2.1 07-Feb-2011  bouyer file grf_rbreg.h was added on branch bouyer-quota2 on 2011-02-08 16:19:22 +0000
 1.2.6.2 06-Jun-2011  jruoho Sync with HEAD.
 1.2.6.1 08-Feb-2011  jruoho file grf_rbreg.h was added on branch jruoho-x86intr on 2011-06-06 09:05:38 +0000
 1.2.2.2 05-Mar-2011  rmind sync with head
 1.2.2.1 08-Feb-2011  rmind file grf_rbreg.h was added on branch rmind-uvmplock on 2011-03-05 20:50:25 +0000
 1.3 02-Feb-2024  andvar s/Staus/Status/ in comments.
 1.2 08-Feb-2011  rmind branches: 1.2.2; 1.2.6;
Remove clause 3 (UCB advertising clause) from the University of Utah
copyright. Confirmed by Mike Hibler, mike at cs.utah.edu - thanks!
Also, merge UCB and Utah copyright texts back into one, as they
originally were.

Extra verification by snj@.
 1.1 07-Feb-2011  tsutsui branches: 1.1.2;
Resurrect and move retired ITE files that are still used by bootloaders.
 1.1.2.3 17-Feb-2011  bouyer Sync with HEAD
 1.1.2.2 08-Feb-2011  bouyer Sync with HEAD
 1.1.2.1 07-Feb-2011  bouyer file grf_tcreg.h was added on branch bouyer-quota2 on 2011-02-08 16:19:22 +0000
 1.2.6.2 06-Jun-2011  jruoho Sync with HEAD.
 1.2.6.1 08-Feb-2011  jruoho file grf_tcreg.h was added on branch jruoho-x86intr on 2011-06-06 09:05:38 +0000
 1.2.2.2 05-Mar-2011  rmind sync with head
 1.2.2.1 08-Feb-2011  rmind file grf_tcreg.h was added on branch rmind-uvmplock on 2011-03-05 20:50:25 +0000
 1.4 05-Jul-2021  tsutsui Get rid of obsolete grfreg.h. From OpenBSD.
 1.3 12-Feb-2011  tsutsui branches: 1.3.2; 1.3.6; 1.3.76;
Add dumb framebuffer (no acceleration, no colormap) support
for HP362 and HP382.

Tested on A1473-69510 (HP362 VGA-res) and A1474-69511 (HP382 mid-res).
 1.2 08-Feb-2011  rmind Remove clause 3 (UCB advertising clause) from the University of Utah
copyright. Confirmed by Mike Hibler, mike at cs.utah.edu - thanks!
Also, merge UCB and Utah copyright texts back into one, as they
originally were.

Extra verification by snj@.
 1.1 07-Feb-2011  tsutsui branches: 1.1.2;
Resurrect and move retired ITE files that are still used by bootloaders.
 1.1.2.3 17-Feb-2011  bouyer Sync with HEAD
 1.1.2.2 08-Feb-2011  bouyer Sync with HEAD
 1.1.2.1 07-Feb-2011  bouyer file grfreg.h was added on branch bouyer-quota2 on 2011-02-08 16:19:22 +0000
 1.3.76.1 01-Aug-2021  thorpej Sync with HEAD.
 1.3.6.2 06-Jun-2011  jruoho Sync with HEAD.
 1.3.6.1 12-Feb-2011  jruoho file grfreg.h was added on branch jruoho-x86intr on 2011-06-06 09:05:38 +0000
 1.3.2.2 05-Mar-2011  rmind sync with head
 1.3.2.1 12-Feb-2011  rmind file grfreg.h was added on branch rmind-uvmplock on 2011-03-05 20:50:25 +0000
 1.15 15-Jan-2023  tsutsui TAB/space cleanup.
 1.14 08-Feb-2011  rmind branches: 1.14.86;
Remove clause 3 (UCB advertising clause) from the University of Utah
copyright. Confirmed by Mike Hibler, mike at cs.utah.edu - thanks!
Also, merge UCB and Utah copyright texts back into one, as they
originally were.

Extra verification by snj@.
 1.13 07-Feb-2011  tsutsui Resurrect and move retired ITE files that are still used by bootloaders.
 1.12 28-Apr-2008  martin branches: 1.12.22; 1.12.28; 1.12.30;
Remove clause 3 and 4 from TNF licenses
 1.11 28-Aug-2006  tsutsui branches: 1.11.56; 1.11.58; 1.11.60;
Remove unneeded #include <sys/device.h> which also requires <prop/proplib.h>.
 1.10 11-Dec-2005  christos branches: 1.10.4; 1.10.8;
merge ktrace-lwp.
 1.9 20-Feb-2005  tsutsui branches: 1.9.4;
Use ANSI function decls.
 1.8 14-Nov-2003  tsutsui branches: 1.8.8; 1.8.10;
Misc cleanup:
- KNF
- WARNSfy
- remove __P()
- remove register declarations
- const'ify some variables
- make some local functions/variables static
- bcopy -> memcpy
- bcmp -> memcmp
- bzero -> memset
- space/TAB fix
etc.
 1.7 14-Nov-2003  tsutsui Use "" rather than '\0' for null string.
 1.6 14-Nov-2003  tsutsui Revert part of previous NULL -> '\0' changes, where actually NULL is required.
 1.5 28-Oct-2003  tsutsui NULL -> '\0'
 1.4 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.3 04-Oct-1997  thorpej branches: 1.3.50;
Copyright assigned to The NetBSD Foundation.
 1.2 14-Apr-1997  thorpej branches: 1.2.4;
Implement an autoconfiguring indirect keyboard driver, removing explcit
dependencies on the HIL keyboard.
 1.1 04-Feb-1997  thorpej Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.2.4.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.3.50.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.3.50.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.50.2 18-Sep-2004  skrll Sync with HEAD.
 1.3.50.1 03-Aug-2004  skrll Sync with HEAD
 1.8.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.8.8.1 29-Apr-2005  kent sync with -current
 1.9.4.1 30-Dec-2006  yamt sync with head.
 1.10.8.1 03-Sep-2006  yamt sync with head.
 1.10.4.1 09-Sep-2006  rpaulo sync with head
 1.11.60.1 16-May-2008  yamt sync with head.
 1.11.58.1 18-May-2008  yamt sync with head.
 1.11.56.1 02-Jun-2008  mjf Sync with HEAD.
 1.12.30.2 17-Feb-2011  bouyer Sync with HEAD
 1.12.30.1 08-Feb-2011  bouyer Sync with HEAD
 1.12.28.1 06-Jun-2011  jruoho Sync with HEAD.
 1.12.22.1 05-Mar-2011  rmind sync with head
 1.14.86.1 22-Jun-2024  martin Pull up following revision(s) (requested by tsutsui in ticket #722):

sys/fs/cd9660/cd9660_util.c: revision 1.16
sys/arch/hp300/stand/common/clock.c: revision 1.14
sys/arch/hp300/stand/common/scsireg.h: revision 1.5
sys/arch/hp300/stand/common/scsireg.h: revision 1.6
sys/arch/hp300/stand/Makefile.buildboot: revision 1.38
sys/arch/hp300/include/bus.h: revision 1.23
sys/arch/hp300/stand/Makefile.buildboot: revision 1.39
sys/arch/hp300/stand/common/sd.c: revision 1.12
sys/arch/hp300/stand/common/prf.c: revision 1.6
sys/arch/hp300/stand/common/sd.c: revision 1.13
usr.sbin/installboot/installboot.8: revision 1.106
usr.sbin/installboot/Makefile: revision 1.59
sys/arch/hp300/stand/common/devopen.c: revision 1.14
usr.sbin/installboot/installboot.8: revision 1.107
sys/arch/hp300/stand/common/ite_dumb.c: revision 1.2
sys/arch/hp300/stand/common/devopen.c: revision 1.15
usr.sbin/installboot/installboot.8: revision 1.108
sys/fs/cd9660/cd9660_extern.h: revision 1.29
usr.sbin/installboot/installboot.8: revision 1.109
tools/Makefile.nbincludes: revision 1.11 (patch)
sys/arch/hp300/dev/rboxreg.h: revision 1.3
sys/arch/hp300/stand/common/scsivar.h: revision 1.5
sys/arch/hp300/dev/dnkbd.c: revision 1.14
sys/arch/hp300/hp300/trap.c: revision 1.156
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.12
sys/arch/hp300/dev/frodoreg.h: revision 1.6
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.13
sys/arch/hp300/stand/common/ite_sti.c: revision 1.2
sys/arch/hp300/stand/common/hil.c: revision 1.15
usr.sbin/installboot/arch/hp300.c: revision 1.18
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.14
sys/arch/hp300/dev/rbox.c: revision 1.4
usr.sbin/installboot/arch/hp300.c: revision 1.19
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.15
sys/sys/bootblock.h: revision 1.59
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.16
usr.sbin/installboot/installboot.h: revision 1.44
sys/arch/hp300/stand/mkboot/volhdr.h: file removal
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.17
sys/arch/hp300/dev/hpib.c: revision 1.45
usr.sbin/installboot/installboot.h: revision 1.45
usr.sbin/installboot/cd9660.c: revision 1.1
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.18
sys/arch/hp300/dev/topcatreg.h: revision 1.3
usr.sbin/installboot/cd9660.c: revision 1.2
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.19
sys/arch/hp300/stand/inst/inst.c: revision 1.25
sys/arch/hp300/stand/uboot/Makefile: revision 1.12
sys/arch/hp300/dev/dvbox.c: revision 1.4
sys/arch/hp300/dev/dma.c: revision 1.45
sys/arch/hp300/stand/uboot/Makefile: revision 1.13
sys/arch/hp300/stand/common/rd.c: revision 1.16
sys/arch/hp300/stand/inst/Makefile: revision 1.12
distrib/hp300/cdroms/installcd/Makefile: revision 1.4
sys/arch/hp300/stand/mkboot/volhdr.h: revision 1.6
sys/arch/hp300/stand/common/machdep.c: revision 1.16
usr.sbin/installboot/fstypes.c: revision 1.14
sys/arch/hp300/hp300/machdep.c: revision 1.238
sys/arch/hp300/include/cpu.h: revision 1.73
sys/arch/hp300/dev/diofbreg.h: revision 1.4
sys/arch/hp300/stand/common/scsi.c: revision 1.12
sys/arch/hp300/stand/common/netio.c: revision 1.19
sys/arch/hp300/stand/common/scsi.c: revision 1.13
sys/arch/hp300/dev/sti_sgc.c: revision 1.8
sys/arch/hp300/dev/rtc.c: revision 1.22
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.20
sys/arch/hp300/stand/common/conf.h: revision 1.4
sys/arch/hp300/hp300/autoconf.c: revision 1.111
sys/arch/hp300/stand/common/conf.c: revision 1.15
sys/arch/hp300/stand/mkboot/Makefile: revision 1.12
sys/arch/hp300/stand/mkboot/Makefile: revision 1.13
sys/arch/hp300/hp300/autoconf.c: revision 1.114
sys/arch/hp300/dev/dcmreg.h: revision 1.11
sys/arch/hp300/dev/diofbvar.h: revision 1.4
sys/arch/hp300/dev/dcm.c: revision 1.91
sys/fs/cd9660/cd9660_util.c: revision 1.15
sys/arch/hp300/dev/mcclock_frodo.c: revision 1.2

TAB/space cleanup.

installboot(8): formatting improvements

Use Ar foo instead of <foo>; this is mdoc.

Other formatting tweaks.
installboot(8): fix up markup

Don't overuse .Sy - when everything is highlighted, nothing is. Use
.Ic for options &c to get correct PostScript output (both are bold in
plain text).

Use Aq Ar inside .Pa, as both Pa and Ar are rendered as underscored
text in plain text output, and the distinction is lost.

Don't set examples in bold, but give them .Pp space around - they are
much easier to read this way.

Use consistent -width in FILES.
document how to use installboot on netbsd/vax.

PR/57909: Jan-Benedict Glaw: Don't include (build) timestamp when doing a
reproducible build
fix usage string, improve error handling.
add missing chunk for repro-build. fix gcc warnings.
avoid stringop truncation, fix copyright string to prevent assembler warnings.

Fix build as a tool (Jan-Benedict Glaw)

Fix integer overflow of strtol(3) for "loadpoint" address on ILP32 hosts.

This strtol(3) was introduced in rev 1.12 for PR/57909 after netbsd-10,
but it returns LONG_MAX (0x7FFFFFFF) for 0xFFF00000 on ILP32 hosts and
the wrong loadpoint causes "NOT ENOUGH MEMORY" error by the BOOTROMs
on loading uboot.lif on (at least) my 9000/360 and 9000/425t.

Misc cosmetic changes for mostly readability.
- KNF and add some newlines per blocks
- define and use proper bintobcd() macro
- make local functions and variables static

The same uboot.lif binaries are generated.

Rename ${PROGAOUT} -> ${PROGELF} to reflect reality.
Use proper signedness for the LIF file system data structures.

Ancient 4.3BSD used short and int for location, file size, file type,
and addresses etc. but all of them should be unsigned.

Also rename several variables and add comments for readability.
The LIF file system info can be found in "The HPDir Project" page:
https://www.hp9845.net/9845/projects/hpdir/
The same uboot.lif binaries are generated.

Add a preliminary CD boot support to uboot for preparation of PR/54455.
Briefly tested on mame, but not enalbed yet.

Recognize SCSI CD-ROM devices as a booted device properly.

Necessary for PR port-hp300/54455, to boot an md root root RAMDISK

kernel from CD-ROM without "WARNING: can't find match for bootdev:"
prompt.

Sync with src/sys/arch/hp300/stand/mkboot/volhdr.h rev 1.6.
https://mail-index.netbsd.org/source-changes/2024/05/07/msg151195.html

Use proper signedness for the LIF file system data structures.
mkboot should use this MI <sys/bootblock.h> and volhdr.h should
be removed soon.

Use MI <sys/bootblock.h> to refer LIF filesystem structures.
This should have been done when LIF definitions were initially added
to <sys/bootblock.h> for MI installboot(8).

Enable SUPPORT_CD on uboot.

Make cd9660_util.c usable in userland tools like installboot(8).

This was partially done for src/distrib/cdrom/macppc_installboot,
but more strict prototypes are necessary for native binary builds.

Install cd9660 related system headers for tools installboot(8) builds.

Reorder function prototypes per source files.

Add cd9660 support to search a bootloader file in the target file system.

Also add CD boot support for hp300, using a bootloader file in cd9660 fs.
This is a tool's part to close PR/54455.

HP 9000/300 machines read LIF directory entry allocated after
the LIF volume header at the top of the boot disk during bootstrap,
and a bootstrap file must be contiguously allocated on the disk
due to limitation of the LIF specification.

Current NetBSD/hp300's bootloader is larger than ~80KB so we have
to prepare a special 'boot' partition for FFS (that has only 8KB (ffsv1)
or 32KB (ffsv2) spaces) disks to put such a large bootloader.

On the other hand, on ISO9660 fs all files are allocated contiguously
so we can specify a bootloader file in the target ISO9660 directly
in the LIF directory entry.

Note we can simply use the existing "append" option to create bootable
CD ISO for hp300, but it looks some emulators (at leaset MAME) reject
such non-standard ISO files, i.e. with an appended bootloader file at
the end of the image.

Put a RAMDISK kernel and SYS_UBOOT into hp300 installcd to make it bootable.

This should finally close PR/54455.

Fix tools build errors on Cygwin.

Appease warnings on building tools/installboot on Cygwin.
 1.2 08-Feb-2011  rmind branches: 1.2.2; 1.2.6;
Remove clause 3 (UCB advertising clause) from the University of Utah
copyright. Confirmed by Mike Hibler, mike at cs.utah.edu - thanks!
Also, merge UCB and Utah copyright texts back into one, as they
originally were.

Extra verification by snj@.
 1.1 07-Feb-2011  tsutsui branches: 1.1.2;
Resurrect and move retired ITE files that are still used by bootloaders.
 1.1.2.3 17-Feb-2011  bouyer Sync with HEAD
 1.1.2.2 08-Feb-2011  bouyer Sync with HEAD
 1.1.2.1 07-Feb-2011  bouyer file hilreg.h was added on branch bouyer-quota2 on 2011-02-08 16:19:22 +0000
 1.2.6.2 06-Jun-2011  jruoho Sync with HEAD.
 1.2.6.1 08-Feb-2011  jruoho file hilreg.h was added on branch jruoho-x86intr on 2011-06-06 09:05:38 +0000
 1.2.2.2 05-Mar-2011  rmind sync with head
 1.2.2.1 08-Feb-2011  rmind file hilreg.h was added on branch rmind-uvmplock on 2011-03-05 20:50:25 +0000
 1.9 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.8 02-Jul-2006  tsutsui branches: 1.8.10;
Remove sc_table[] decl, which is in device.h.
 1.7 25-Jun-2006  tsutsui Use (uint8_t *) to specify buffers for hpib xfers.
 1.6 11-Dec-2005  christos branches: 1.6.4; 1.6.8; 1.6.16;
merge ktrace-lwp.
 1.5 20-Feb-2005  tsutsui branches: 1.5.4;
Use ANSI function decls.
 1.4 14-Nov-2003  tsutsui branches: 1.4.8; 1.4.10;
Misc cleanup:
- KNF
- WARNSfy
- remove __P()
- remove register declarations
- const'ify some variables
- make some local functions/variables static
- bcopy -> memcpy
- bcmp -> memcmp
- bzero -> memset
- space/TAB fix
etc.
 1.3 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.2 12-May-1997  thorpej branches: 1.2.56;
Don't use hardcoded hex for the address of the internal HP-IB interface.
Instead, use definitions from <hp300/dev/dioreg.h>
 1.1 04-Feb-1997  thorpej Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.2.56.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.2.56.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.56.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.56.1 03-Aug-2004  skrll Sync with HEAD
 1.4.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.4.8.1 29-Apr-2005  kent sync with -current
 1.5.4.2 03-Sep-2007  yamt sync with head.
 1.5.4.1 30-Dec-2006  yamt sync with head.
 1.6.16.1 13-Jul-2006  gdamore Merge from HEAD.
 1.6.8.2 11-Aug-2006  yamt sync with head
 1.6.8.1 26-Jun-2006  yamt sync with head.
 1.6.4.1 09-Sep-2006  rpaulo sync with head
 1.8.10.1 12-Mar-2007  rmind Sync with HEAD.
 1.6 05-Jul-2021  tsutsui Cleanup duplicated CS/80 indentify structures. From OpenBSD.

https://marc.info/?l=openbsd-cvs&m=113227249626888&w=2
> Define the CS/80 identify structure only once and correctly, instead of
> duplicating it in every CS/80 driver and using an hardcoded number for
> its size.
> No functional change.

https://marc.info/?l=openbsd-cvs&m=113273001020159&w=2
> Pick HP-IB describe structures changes from main kernel code here as well.
 1.5 25-Jun-2006  tsutsui branches: 1.5.154; 1.5.166;
Use (uint8_t *) to specify buffers for hpib xfers.
 1.4 11-Dec-2005  christos branches: 1.4.4; 1.4.8; 1.4.16;
merge ktrace-lwp.
 1.3 14-Nov-2003  tsutsui branches: 1.3.16;
Misc cleanup:
- KNF
- WARNSfy
- remove __P()
- remove register declarations
- const'ify some variables
- make some local functions/variables static
- bcopy -> memcpy
- bcmp -> memcmp
- bzero -> memset
- space/TAB fix
etc.
 1.2 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.1 04-Feb-1997  thorpej branches: 1.1.60;
Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.1.60.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.60.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.60.1 03-Aug-2004  skrll Sync with HEAD
 1.3.16.1 30-Dec-2006  yamt sync with head.
 1.4.16.1 13-Jul-2006  gdamore Merge from HEAD.
 1.4.8.1 26-Jun-2006  yamt sync with head.
 1.4.4.1 09-Sep-2006  rpaulo sync with head
 1.5.166.1 01-Aug-2021  thorpej Sync with HEAD.
 1.5.154.1 14-Jul-2021  martin Pull up following revision(s) (requested by tsutsui in ticket #1323):

sys/arch/hp300/dev/rd.c: revision 1.109
sys/arch/hp300/stand/Makefile.buildboot: revision 1.37
sys/arch/hp300/stand/common/ct.c: revision 1.8
sys/arch/hp300/dev/hpibvar.h: revision 1.22
sys/arch/hp300/dev/ct.c: revision 1.62
sys/arch/hp300/dev/hpibvar.h: revision 1.23
sys/arch/hp300/dev/ct.c: revision 1.63
sys/arch/hp300/dev/hpibvar.h: revision 1.24
sys/arch/hp300/dev/mt.c: revision 1.55
sys/arch/hp300/dev/rdreg.h: revision 1.14
sys/arch/hp300/dev/hpib.c: revision 1.43 (via patch)
sys/arch/hp300/dev/rdreg.h: revision 1.15
sys/arch/hp300/dev/rdreg.h: revision 1.16
sys/arch/hp300/dev/rdreg.h: revision 1.17
etc/etc.hp300/MAKEDEV.conf: revision 1.15
sys/arch/hp300/stand/common/hpibvar.h: revision 1.6
sys/arch/hp300/stand/common/rd.c: revision 1.11
sys/arch/hp300/dev/ctreg.h: revision 1.11
sys/arch/hp300/dev/rdvar.h: revision 1.24
sys/arch/hp300/dev/rdvar.h: revision 1.25
sys/arch/hp300/dev/rdvar.h: revision 1.26
sys/arch/hp300/dev/rd.c: revision 1.103
sys/arch/hp300/dev/rd.c: revision 1.104
sys/arch/hp300/dev/rd.c: revision 1.105
sys/arch/hp300/dev/rd.c: revision 1.106
sys/arch/hp300/dev/rd.c: revision 1.107
sys/arch/hp300/dev/rd.c: revision 1.108

Consistently use #define<tab> here.

Consistently use #define<tab> as rdreg.h.

No need to bother to use aprint_debug(9) inside #ifdef DEBUG block.

Pull HP-IB probe fixes from OpenBSD/hp300.
https://marc.info/?l=openbsd-cvs&m=113217630426615&w=2

Overhaul the way HP-IB devices are probed. We will now do an exhaustive
probe of the (slave, punit) tuple space, since this is the only way we
can get a dual disk or dual tape enclosure to attach two devices of the
same kind.

This allows using multiple rd(4) disk images on the same slave emulated
by HPDisk (and probably the real 9122D with dual floppy disk drives).

Thanks to Miod Vallat for suggesting this fix.

Move attach messages from common rdident() to explicit rdattach().

Cleanup duplicated CS/80 indentify structures. From OpenBSD.
https://marc.info/?l=openbsd-cvs&m=113227249626888&w=2

Define the CS/80 identify structure only once and correctly, instead of
duplicating it in every CS/80 driver and using an hardcoded number for
its size.
No functional change.
https://marc.info/?l=openbsd-cvs&m=113273001020159&w=2

Pick HP-IB describe structures changes from main kernel code here as well.

Add support of multiple rd(4) disks on all punits for HPDisk.

Special thanks to Anders Gustafsson, the author of "HPDisk"
(GPIB disk emulator) http://www.dalton.ax/hpdisk/
for providing bare boards and improving firmwares for NetBSD/hp300.

Specify -fno-unwind-tables to shrink binaries.

Before:
text data bss dec hex filename
77902 4328 137120 219350 358d6 uboot

After:
text data bss dec hex filename
64186 4328 137120 205634 32342 uboot

Create rd3 device nodes, for HPDisk.

Add Device and drive info of 2202A, 7908A, 7911A, and 7941A.

Geometries and description info are taken from hpdrive.ini.sample
in HPDrive. Briefly tested on HPDisk.

Print rd(4) capacity and geometry info as sd(4) and wd(4) do.

Before:
rd0 at hpibbus1 slave 0 punit 0: 7937H
rd0: 698 cylinders, 13 heads, 1116102 blocks, 512 bytes/block

After:
rd0 at hpibbus1 slave 0 punit 0: 7937H
rd0: 544 MB, 698 cyl, 13 head, 123 sec, 512 bytes/block x 1116102 blocks
 1.16 29-Apr-2024  tsutsui Don't panic as a fatal error on receiving packets with invalid length.

Such errors could happen on aged and fragile 10BASE-2 hub etc.
 1.15 21-Apr-2023  tsutsui Avoid an extern declaration in .c file. Just declare it as static.

Suggested on tech-userlevel@.
 1.14 21-Nov-2022  tsutsui branches: 1.14.2;
Make local functions and variables static.
 1.13 21-Jun-2014  tsutsui Appease gcc48 -Wunused-but-set-variable warnings.
 1.12 01-May-2014  tsutsui Reduce a number of getsecs() calls in le_get() to make netboot a bit faster.
 1.11 12-Jan-2009  tsutsui branches: 1.11.14; 1.11.24; 1.11.28; 1.11.38;
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.10 04-Mar-2007  christos branches: 1.10.40; 1.10.44; 1.10.52;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.9 11-Dec-2005  christos branches: 1.9.26;
merge ktrace-lwp.
 1.8 20-Feb-2005  tsutsui branches: 1.8.4;
Use ANSI function decls.
 1.7 14-Nov-2003  tsutsui branches: 1.7.8; 1.7.10;
Misc cleanup:
- KNF
- WARNSfy
- remove __P()
- remove register declarations
- const'ify some variables
- make some local functions/variables static
- bcopy -> memcpy
- bcmp -> memcmp
- bzero -> memset
- space/TAB fix
etc.
 1.6 13-Mar-2003  drochner branches: 1.6.2;
cope with removal of this sick NENTS macro from libsa/netif.h
 1.5 27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.4 09-Apr-1999  drochner branches: 1.4.16; 1.4.20;
actually include <net/if_ether.h> to get these constants
 1.3 25-Mar-1999  thorpej branches: 1.3.2;
Use ETHER_*_LEN constants from <net/if_ether.h> instead of defining them
ourselves.
 1.2 26-Dec-1997  scottr Do better reporting of transmit errors.
 1.1 04-Feb-1997  thorpej branches: 1.1.12;
Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.1.12.1 26-Dec-1997  scottr Do better reporting of transmit errors.
 1.3.2.1 05-May-1999  perry branches: 1.3.2.1.2;
pullup 1.3->1.4 (he)
 1.3.2.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.4.20.1 18-Oct-2002  nathanw Catch up to -current.
 1.4.16.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.6.2.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.6.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.6.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.6.2.1 03-Aug-2004  skrll Sync with HEAD
 1.7.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.7.8.1 29-Apr-2005  kent sync with -current
 1.8.4.1 03-Sep-2007  yamt sync with head.
 1.9.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.10.52.1 19-Jan-2009  skrll Sync with HEAD.
 1.10.44.1 04-May-2009  yamt sync with head.
 1.10.40.1 17-Jan-2009  mjf Sync with HEAD.
 1.11.38.1 10-Aug-2014  tls Rebase.
 1.11.28.1 18-May-2014  rmind sync with head
 1.11.24.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.11.14.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.14.2.1 11-May-2024  martin Pull up following revision(s) (requested by tsutsui in ticket #685):

sys/arch/hp300/stand/common/if_le.c: revision 1.15
sys/arch/hp300/stand/common/if_le.c: revision 1.16

Avoid an extern declaration in .c file. Just declare it as static.
Suggested on tech-userlevel@.

Don't panic as a fatal error on receiving packets with invalid length.

Such errors could happen on aged and fragile 10BASE-2 hub etc.
 1.6 26-Jul-2012  tsutsui Remove '__attribute__((__packed__))' from structure definisions
for Am7990 LANCE registers where no implicit padding is expected.

gcc 4.5.3 seems to generate strange and wrong instructions
(four moveb insns against u_short members) if packed attribute
is specified in this case, then netboot fails immediately.

Should be pulled up to netbsd-6.
 1.5 11-Dec-2005  christos branches: 1.5.112; 1.5.118;
merge ktrace-lwp.
 1.4 14-Nov-2003  tsutsui Misc cleanup:
- KNF
- WARNSfy
- remove __P()
- remove register declarations
- const'ify some variables
- make some local functions/variables static
- bcopy -> memcpy
- bcmp -> memcmp
- bzero -> memset
- space/TAB fix
etc.
 1.3 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.2 27-May-2001  gmcgarry branches: 1.2.8; 1.2.24;
Protect against possible alignment problems.
 1.1 04-Feb-1997  thorpej branches: 1.1.38;
Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.1.38.1 21-Jun-2001  nathanw Catch up to -current.
 1.2.24.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.24.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.24.1 03-Aug-2004  skrll Sync with HEAD
 1.2.8.2 27-May-2001  gmcgarry Protect against possible alignment problems.
 1.2.8.1 27-May-2001  gmcgarry file if_lereg.h was added on branch nathanw_sa on 2001-05-27 05:31:59 +0000
 1.5.118.1 08-Aug-2012  martin Pull up following revision(s) (requested by tsutsui in ticket #468):
sys/arch/hp300/stand/common/if_lereg.h: revision 1.6
Remove '__attribute__((__packed__))' from structure definisions
for Am7990 LANCE registers where no implicit padding is expected.
gcc 4.5.3 seems to generate strange and wrong instructions
(four moveb insns against u_short members) if packed attribute
is specified in this case, then netboot fails immediately.
Should be pulled up to netbsd-6.
 1.5.112.1 30-Oct-2012  yamt sync with head
 1.23 30-May-2025  tsutsui Misc cleanup.

- make local variables static
- make read only variable const
- remove a redundant arg
- use uint8_t rather than u_char
- use consistent style
- some KNF
 1.22 29-May-2025  tsutsui Consolidate scroll and cursor drawing ops into common ITE layer.

No functional change, just for readability.
Tested on 380 (topcat) and 382 (sti).
 1.21 26-May-2025  tsutsui Also use sti(4) ROM functions for 362/382 framebuffers on bootloader.

Mostly taken on OpenBSD/hp300.
Tested on 382 with VGA-res EVRX, and no visible regression on
425e (sti EVRX), 425t (sti CRX), and 380 (topcat).
 1.20 21-Apr-2023  tsutsui branches: 1.20.6;
Remove ancient /* ARGSUSED */ lint comments.
 1.19 05-Jul-2021  tsutsui Get rid of obsolete grfreg.h. From OpenBSD.
 1.18 26-Feb-2016  christos branches: 1.18.34;
PR/50852: David Binderman: make code more readable (although it was correct
anyway)
 1.17 13-Apr-2014  tsutsui branches: 1.17.4;
Add sti(4) at sgc screen console support. From (the late) OpenBSD/hp300.

Tested on HP9000/425e, which was sent from Miod Vallat and
demonstrated at Open Source unConference 2014 Kagawa.
 1.16 12-Feb-2011  tsutsui branches: 1.16.4; 1.16.10; 1.16.14; 1.16.18; 1.16.28;
Add dumb framebuffer (no acceleration, no colormap) support
for HP362 and HP382.

Tested on A1473-69510 (HP362 VGA-res) and A1474-69511 (HP382 mid-res).
 1.15 10-Feb-2011  tsutsui Pull support for Tigershark monochrome framebuffer from OpenBSD.
Untested (no hardware), but doesn't break existing HP425t topcat.
 1.14 10-Feb-2011  tsutsui Pull OpenBSD's standalone ITE driver reorganization:
- merge similar clear, putc, cursor, and scroll ops for all DIO framebuffers
- rename and move hyper_windowmove() to ite_dio_windowmove1bpp()
to use it among all dumb monochrome framebuffers
- ditto hyper_putc() to ite_dio_putc1bpp()
- remove unnecessary flags, macro, function args, and structure members
- remove trailing spaces and tabs

Also misc cosmetics to reduce diffs from OpenBSD,
and some KNF that generates diffs from OpenBSD.

Tested on HP382 and HP425t.
 1.13 10-Feb-2011  tsutsui Remove unused deinit functions. From OpenBSD.
 1.12 10-Feb-2011  tsutsui All framebuffer drivers use common readbyte and writeglyph functions
so no need to put them into per driver function pointers. From OpenBSD.

Tested on HP382 (serial) and HP425t (topcat).
 1.11 08-Feb-2011  rmind Remove clause 3 (UCB advertising clause) from the University of Utah
copyright. Confirmed by Mike Hibler, mike at cs.utah.edu - thanks!
Also, merge UCB and Utah copyright texts back into one, as they
originally were.

Extra verification by snj@.
 1.10 07-Feb-2011  tsutsui Resurrect and move retired ITE files that are still used by bootloaders.
 1.9 07-Mar-2007  he branches: 1.9.66; 1.9.72; 1.9.74;
Fix an instance of "void *v, x;" and cast to char* before doing
pointer arithmetic.
 1.8 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.7 19-Jul-2006  tsutsui branches: 1.7.10;
Adapt stand sources to changes of intio device offset macro.
 1.6 02-Jul-2006  tsutsui Remove sc_table[] decl, which is in device.h.
 1.5 11-Dec-2005  christos branches: 1.5.4; 1.5.8; 1.5.16;
merge ktrace-lwp.
 1.4 20-Feb-2005  tsutsui branches: 1.4.4;
Use ANSI function decls.
 1.3 14-Nov-2003  tsutsui branches: 1.3.8; 1.3.10;
Misc cleanup:
- KNF
- WARNSfy
- remove __P()
- remove register declarations
- const'ify some variables
- make some local functions/variables static
- bcopy -> memcpy
- bcmp -> memcmp
- bzero -> memset
- space/TAB fix
etc.
 1.2 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.1 04-Feb-1997  thorpej branches: 1.1.60;
Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.1.60.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.1.60.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.60.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.60.1 03-Aug-2004  skrll Sync with HEAD
 1.3.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.3.8.1 29-Apr-2005  kent sync with -current
 1.4.4.2 03-Sep-2007  yamt sync with head.
 1.4.4.1 30-Dec-2006  yamt sync with head.
 1.5.16.1 13-Jul-2006  gdamore Merge from HEAD.
 1.5.8.1 11-Aug-2006  yamt sync with head
 1.5.4.1 09-Sep-2006  rpaulo sync with head
 1.7.10.1 12-Mar-2007  rmind Sync with HEAD.
 1.9.74.2 17-Feb-2011  bouyer Sync with HEAD
 1.9.74.1 08-Feb-2011  bouyer Sync with HEAD
 1.9.72.1 06-Jun-2011  jruoho Sync with HEAD.
 1.9.66.1 05-Mar-2011  rmind sync with head
 1.16.28.1 10-Aug-2014  tls Rebase.
 1.16.18.1 18-May-2014  rmind sync with head
 1.16.14.2 03-Dec-2017  jdolecek update from HEAD
 1.16.14.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.16.10.1 21-May-2014  bouyer Pull up following revision(s) (requested by tsutsui in ticket #1058):
sys/arch/hp300/conf/files.hp300: revision 1.88
sys/arch/hp300/include/autoconf.h: revision 1.13
sys/dev/ic/sti.c: revision 1.17
sys/arch/hp300/dev/frodo.c: revision 1.31
sys/arch/hp300/conf/GENERIC: revision 1.173
sys/arch/hp300/hp300/machdep.c: revision 1.229
sys/arch/hp300/dev/frodo.c: revision 1.32
sys/arch/hp300/hp300/autoconf.c: revision 1.102
sys/arch/hp300/dev/frodoreg.h: revision 1.5
sys/arch/hp300/stand/common/ite_sti.c: revision 1.1
sys/arch/hp300/stand/common/itevar.h: revision 1.16
sys/arch/hp300/hp300/autoconf.c: revision 1.105
sys/arch/hp300/dev/sti_sgcvar.h: revision 1.1
sys/arch/hp300/stand/common/apci.c: revision 1.12
sys/arch/hp300/stand/common/apci.c: revision 1.13
sys/arch/hp300/dev/dnkbd.c: revision 1.6
sys/arch/hp300/dev/dnkbd.c: revision 1.7
sys/arch/hp300/stand/inst/version: revision 1.12
sys/arch/hp300/dev/com_frodo.c: revision 1.9
sys/arch/hp300/stand/common/ite.c: revision 1.17
sys/arch/hp300/conf/GENERIC: revision 1.181
sys/arch/hp300/dev/sti_sgc.c: revision 1.1
sys/arch/hp300/stand/common/dnkbd.c: revision 1.13
sys/arch/hp300/dev/sti_sgc.c: revision 1.2
sys/dev/ic/stivar.h: revision 1.8
sys/arch/hp300/dev/rtc.c: revision 1.21
sys/arch/hp300/conf/INSTALL: revision 1.56
sys/arch/hp300/conf/INSTALL: revision 1.58
sys/arch/hp300/stand/uboot/version: revision 1.19
sys/arch/hp300/stand/common/samachdep.h: revision 1.17
sys/arch/hp300/stand/common/clock.c: revision 1.12
sys/arch/hp300/dev/mcclock_frodo.c: revision 1.1
sys/arch/hp300/stand/Makefile.buildboot: revision 1.34
sys/arch/hp300/conf/files.hp300: revision 1.87
Add sti at sgc framebuffer.
Ported from OpenBSD by kiyohara@.
Fix a botch on switching from apci (and dca) to MI com(4) 10 years ago.
I.e. fix apci device address per FRODO_BASE macro change
in frodoreg.h rev 1.2. Now bootloader works with serial console
on HP425e (which has only com at frodo).
Thanks to miod@openbsd for providing his 425e.
Add sti(4) at sgc screen console support. From (the late) OpenBSD/hp300.
Tested on HP9000/425e, which was sent from Miod Vallat and
demonstrated at Open Source unConference 2014 Kagawa.
Check the service switch on 425e to select apci serial console.
Taken from OpenBSD/hp300. See the following comment for details:
> * Check the service switch. On the 425e, this is a physical
> * switch, unlike other frodo-based machines, so we can use it
> * as a serial vs internal video selector, since the PROM can not
> * be configured for serial console.
Add proper RealTime Clock support for HP9000/425e.
As the OpenBSD/hp300 page says 425e doesn't have the traditional
RTC at intio (as it also lacks DCA 16550 serial at intio?),
but after a few hour investigation it turns out that
425e uses mc146818 compatible calendar clock in
the Apollo "frodo" utility chip and the frodo chip on
425e actually has the 32kHz OSC and is actually backed up
by the onboard lithium battery.
Tested on HP425e (with mcclock) and HP362 (with old rtc).
Add RTC support for HP9000/425e to bootloader too.
Also put several cleanup:
- make local functions and variables static
- use proper variable types
- some KNF
Note it turns out that extreme slowness of netboot on hp300 is
caused by the too slow access of the traditional RTC chip at intio
(i.e. netboot on 425e is so much faster than others). Oh well.
Add proper consinit(9) support for sti(4) at sgc framebuffer on hp300.
The cnattach functions for sti(4) and service switch check method
for 425e in com_frodo.c are taken from OpenBSD.
The strategy how to choose the console device in hp300_cninit() is
quite diverged from 4.4BSD and OpenBSD so it's tweaked by me.
Also put several changes in sti_sgc.c to reduce diffs from OpenBSD/hp300.
Tested on 425e and 362 (which still uses gendiofb(4), not sti(4)).
XXX: sti(4) requires uvm_km_alloc(9) and uvm_map_protect(9)
to copy and call ROM functions on the executable memory region, so
it can be called before UVM and related initializations are complete.
Probably it's time to consider about MI "deferred consinit()" API
in init_main.c (or elsewhere) for modern complicated VM system...
Also fix the apci device address in dnkbd.c as apci.c rev 1.12:
http://mail-index.netbsd.org/source-changes/2014/04/10/msg053940.html
Finally dnkbd(4) is confirmed working at least on bootloader.
Thanks again to Miod Vallat.
Make the Apollo Domain keyboard actually work.
Tested on HP9000/425e and the keyboard model A1630-82001 R2 (RX-60857-HW)
provided by Miod Vallat. Mouse support needs more work.
Pull random notes on the Apollo Domain keyboard from ancient PR/3528.
Bump versions to denote recent 425e related changes.
Probe mcclock only on 425e to avoid an extra "not configured" message.
Add and enable sti(4) at sgc in install kernels for 425e.
Tested on both serial console and framebuffer console.
(switched by the service switch on the back panel)
 1.16.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.17.4.1 19-Mar-2016  skrll Sync with HEAD
 1.18.34.1 01-Aug-2021  thorpej Sync with HEAD.
 1.20.6.1 02-Aug-2025  perseant Sync with HEAD
 1.3 26-May-2025  tsutsui Also use sti(4) ROM functions for 362/382 framebuffers on bootloader.

Mostly taken on OpenBSD/hp300.
Tested on 382 with VGA-res EVRX, and no visible regression on
425e (sti EVRX), 425t (sti CRX), and 380 (topcat).
 1.2 15-Jan-2023  tsutsui branches: 1.2.6;
TAB/space cleanup.
 1.1 12-Feb-2011  tsutsui branches: 1.1.2; 1.1.4; 1.1.8; 1.1.92;
Add dumb framebuffer (no acceleration, no colormap) support
for HP362 and HP382.

Tested on A1473-69510 (HP362 VGA-res) and A1474-69511 (HP382 mid-res).
 1.1.92.1 22-Jun-2024  martin Pull up following revision(s) (requested by tsutsui in ticket #722):

sys/fs/cd9660/cd9660_util.c: revision 1.16
sys/arch/hp300/stand/common/clock.c: revision 1.14
sys/arch/hp300/stand/common/scsireg.h: revision 1.5
sys/arch/hp300/stand/common/scsireg.h: revision 1.6
sys/arch/hp300/stand/Makefile.buildboot: revision 1.38
sys/arch/hp300/include/bus.h: revision 1.23
sys/arch/hp300/stand/Makefile.buildboot: revision 1.39
sys/arch/hp300/stand/common/sd.c: revision 1.12
sys/arch/hp300/stand/common/prf.c: revision 1.6
sys/arch/hp300/stand/common/sd.c: revision 1.13
usr.sbin/installboot/installboot.8: revision 1.106
usr.sbin/installboot/Makefile: revision 1.59
sys/arch/hp300/stand/common/devopen.c: revision 1.14
usr.sbin/installboot/installboot.8: revision 1.107
sys/arch/hp300/stand/common/ite_dumb.c: revision 1.2
sys/arch/hp300/stand/common/devopen.c: revision 1.15
usr.sbin/installboot/installboot.8: revision 1.108
sys/fs/cd9660/cd9660_extern.h: revision 1.29
usr.sbin/installboot/installboot.8: revision 1.109
tools/Makefile.nbincludes: revision 1.11 (patch)
sys/arch/hp300/dev/rboxreg.h: revision 1.3
sys/arch/hp300/stand/common/scsivar.h: revision 1.5
sys/arch/hp300/dev/dnkbd.c: revision 1.14
sys/arch/hp300/hp300/trap.c: revision 1.156
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.12
sys/arch/hp300/dev/frodoreg.h: revision 1.6
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.13
sys/arch/hp300/stand/common/ite_sti.c: revision 1.2
sys/arch/hp300/stand/common/hil.c: revision 1.15
usr.sbin/installboot/arch/hp300.c: revision 1.18
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.14
sys/arch/hp300/dev/rbox.c: revision 1.4
usr.sbin/installboot/arch/hp300.c: revision 1.19
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.15
sys/sys/bootblock.h: revision 1.59
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.16
usr.sbin/installboot/installboot.h: revision 1.44
sys/arch/hp300/stand/mkboot/volhdr.h: file removal
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.17
sys/arch/hp300/dev/hpib.c: revision 1.45
usr.sbin/installboot/installboot.h: revision 1.45
usr.sbin/installboot/cd9660.c: revision 1.1
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.18
sys/arch/hp300/dev/topcatreg.h: revision 1.3
usr.sbin/installboot/cd9660.c: revision 1.2
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.19
sys/arch/hp300/stand/inst/inst.c: revision 1.25
sys/arch/hp300/stand/uboot/Makefile: revision 1.12
sys/arch/hp300/dev/dvbox.c: revision 1.4
sys/arch/hp300/dev/dma.c: revision 1.45
sys/arch/hp300/stand/uboot/Makefile: revision 1.13
sys/arch/hp300/stand/common/rd.c: revision 1.16
sys/arch/hp300/stand/inst/Makefile: revision 1.12
distrib/hp300/cdroms/installcd/Makefile: revision 1.4
sys/arch/hp300/stand/mkboot/volhdr.h: revision 1.6
sys/arch/hp300/stand/common/machdep.c: revision 1.16
usr.sbin/installboot/fstypes.c: revision 1.14
sys/arch/hp300/hp300/machdep.c: revision 1.238
sys/arch/hp300/include/cpu.h: revision 1.73
sys/arch/hp300/dev/diofbreg.h: revision 1.4
sys/arch/hp300/stand/common/scsi.c: revision 1.12
sys/arch/hp300/stand/common/netio.c: revision 1.19
sys/arch/hp300/stand/common/scsi.c: revision 1.13
sys/arch/hp300/dev/sti_sgc.c: revision 1.8
sys/arch/hp300/dev/rtc.c: revision 1.22
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.20
sys/arch/hp300/stand/common/conf.h: revision 1.4
sys/arch/hp300/hp300/autoconf.c: revision 1.111
sys/arch/hp300/stand/common/conf.c: revision 1.15
sys/arch/hp300/stand/mkboot/Makefile: revision 1.12
sys/arch/hp300/stand/mkboot/Makefile: revision 1.13
sys/arch/hp300/hp300/autoconf.c: revision 1.114
sys/arch/hp300/dev/dcmreg.h: revision 1.11
sys/arch/hp300/dev/diofbvar.h: revision 1.4
sys/arch/hp300/dev/dcm.c: revision 1.91
sys/fs/cd9660/cd9660_util.c: revision 1.15
sys/arch/hp300/dev/mcclock_frodo.c: revision 1.2

TAB/space cleanup.

installboot(8): formatting improvements

Use Ar foo instead of <foo>; this is mdoc.

Other formatting tweaks.
installboot(8): fix up markup

Don't overuse .Sy - when everything is highlighted, nothing is. Use
.Ic for options &c to get correct PostScript output (both are bold in
plain text).

Use Aq Ar inside .Pa, as both Pa and Ar are rendered as underscored
text in plain text output, and the distinction is lost.

Don't set examples in bold, but give them .Pp space around - they are
much easier to read this way.

Use consistent -width in FILES.
document how to use installboot on netbsd/vax.

PR/57909: Jan-Benedict Glaw: Don't include (build) timestamp when doing a
reproducible build
fix usage string, improve error handling.
add missing chunk for repro-build. fix gcc warnings.
avoid stringop truncation, fix copyright string to prevent assembler warnings.

Fix build as a tool (Jan-Benedict Glaw)

Fix integer overflow of strtol(3) for "loadpoint" address on ILP32 hosts.

This strtol(3) was introduced in rev 1.12 for PR/57909 after netbsd-10,
but it returns LONG_MAX (0x7FFFFFFF) for 0xFFF00000 on ILP32 hosts and
the wrong loadpoint causes "NOT ENOUGH MEMORY" error by the BOOTROMs
on loading uboot.lif on (at least) my 9000/360 and 9000/425t.

Misc cosmetic changes for mostly readability.
- KNF and add some newlines per blocks
- define and use proper bintobcd() macro
- make local functions and variables static

The same uboot.lif binaries are generated.

Rename ${PROGAOUT} -> ${PROGELF} to reflect reality.
Use proper signedness for the LIF file system data structures.

Ancient 4.3BSD used short and int for location, file size, file type,
and addresses etc. but all of them should be unsigned.

Also rename several variables and add comments for readability.
The LIF file system info can be found in "The HPDir Project" page:
https://www.hp9845.net/9845/projects/hpdir/
The same uboot.lif binaries are generated.

Add a preliminary CD boot support to uboot for preparation of PR/54455.
Briefly tested on mame, but not enalbed yet.

Recognize SCSI CD-ROM devices as a booted device properly.

Necessary for PR port-hp300/54455, to boot an md root root RAMDISK

kernel from CD-ROM without "WARNING: can't find match for bootdev:"
prompt.

Sync with src/sys/arch/hp300/stand/mkboot/volhdr.h rev 1.6.
https://mail-index.netbsd.org/source-changes/2024/05/07/msg151195.html

Use proper signedness for the LIF file system data structures.
mkboot should use this MI <sys/bootblock.h> and volhdr.h should
be removed soon.

Use MI <sys/bootblock.h> to refer LIF filesystem structures.
This should have been done when LIF definitions were initially added
to <sys/bootblock.h> for MI installboot(8).

Enable SUPPORT_CD on uboot.

Make cd9660_util.c usable in userland tools like installboot(8).

This was partially done for src/distrib/cdrom/macppc_installboot,
but more strict prototypes are necessary for native binary builds.

Install cd9660 related system headers for tools installboot(8) builds.

Reorder function prototypes per source files.

Add cd9660 support to search a bootloader file in the target file system.

Also add CD boot support for hp300, using a bootloader file in cd9660 fs.
This is a tool's part to close PR/54455.

HP 9000/300 machines read LIF directory entry allocated after
the LIF volume header at the top of the boot disk during bootstrap,
and a bootstrap file must be contiguously allocated on the disk
due to limitation of the LIF specification.

Current NetBSD/hp300's bootloader is larger than ~80KB so we have
to prepare a special 'boot' partition for FFS (that has only 8KB (ffsv1)
or 32KB (ffsv2) spaces) disks to put such a large bootloader.

On the other hand, on ISO9660 fs all files are allocated contiguously
so we can specify a bootloader file in the target ISO9660 directly
in the LIF directory entry.

Note we can simply use the existing "append" option to create bootable
CD ISO for hp300, but it looks some emulators (at leaset MAME) reject
such non-standard ISO files, i.e. with an appended bootloader file at
the end of the image.

Put a RAMDISK kernel and SYS_UBOOT into hp300 installcd to make it bootable.

This should finally close PR/54455.

Fix tools build errors on Cygwin.

Appease warnings on building tools/installboot on Cygwin.
 1.1.8.2 06-Jun-2011  jruoho Sync with HEAD.
 1.1.8.1 12-Feb-2011  jruoho file ite_dumb.c was added on branch jruoho-x86intr on 2011-06-06 09:05:38 +0000
 1.1.4.2 05-Mar-2011  rmind sync with head
 1.1.4.1 12-Feb-2011  rmind file ite_dumb.c was added on branch rmind-uvmplock on 2011-03-05 20:50:25 +0000
 1.1.2.2 17-Feb-2011  bouyer Sync with HEAD
 1.1.2.1 12-Feb-2011  bouyer file ite_dumb.c was added on branch bouyer-quota2 on 2011-02-17 11:59:41 +0000
 1.2.6.1 02-Aug-2025  perseant Sync with HEAD
 1.11 27-May-2025  tsutsui Make local functions static.
 1.10 10-Feb-2011  tsutsui branches: 1.10.92;
Pull OpenBSD's standalone ITE driver reorganization:
- merge similar clear, putc, cursor, and scroll ops for all DIO framebuffers
- rename and move hyper_windowmove() to ite_dio_windowmove1bpp()
to use it among all dumb monochrome framebuffers
- ditto hyper_putc() to ite_dio_putc1bpp()
- remove unnecessary flags, macro, function args, and structure members
- remove trailing spaces and tabs

Also misc cosmetics to reduce diffs from OpenBSD,
and some KNF that generates diffs from OpenBSD.

Tested on HP382 and HP425t.
 1.9 10-Feb-2011  tsutsui Move and renamve hyper_ite_fontinit() to ite_fontinit1bpp() to share it
among all monochrome framebuffers. Also rename ite_fontinit() to
ite_fontinit8bpp(). From OpenBSD.
 1.8 08-Feb-2011  rmind Remove clause 3 (UCB advertising clause) from the University of Utah
copyright. Confirmed by Mike Hibler, mike at cs.utah.edu - thanks!
Also, merge UCB and Utah copyright texts back into one, as they
originally were.

Extra verification by snj@.
 1.7 07-Feb-2011  tsutsui Resurrect and move retired ITE files that are still used by bootloaders.
 1.6 28-Jan-2006  tsutsui branches: 1.6.98; 1.6.104; 1.6.106;
Fix botch on ANSIfy.
 1.5 11-Dec-2005  christos branches: 1.5.2;
merge ktrace-lwp.
 1.4 20-Feb-2005  tsutsui branches: 1.4.2; 1.4.4; 1.4.12;
Use ANSI function decls.
 1.3 14-Nov-2003  tsutsui branches: 1.3.8; 1.3.10;
Misc cleanup:
- KNF
- WARNSfy
- remove __P()
- remove register declarations
- const'ify some variables
- make some local functions/variables static
- bcopy -> memcpy
- bcmp -> memcmp
- bzero -> memset
- space/TAB fix
etc.
 1.2 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.1 04-Feb-1997  thorpej branches: 1.1.60;
Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.1.60.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.1.60.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.60.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.60.1 03-Aug-2004  skrll Sync with HEAD
 1.3.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.3.8.1 29-Apr-2005  kent sync with -current
 1.4.12.1 30-Jan-2006  tron Pull up following revision(s) (requested by tsutsui in ticket #1145):
sys/arch/hp300/stand/common/ite_tc.c: revision 1.6
sys/arch/hp300/stand/common/ite_gb.c: revision 1.6
sys/arch/hp300/stand/common/ite_rb.c: revision 1.6
sys/arch/hp300/stand/common/ite_hy.c: revision 1.6
sys/arch/hp300/stand/common/ite_dv.c: revision 1.6
Fix botch on ANSIfy.
 1.4.4.1 21-Jun-2006  yamt sync with head.
 1.4.2.1 30-Jan-2006  tron Pull up following revision(s) (requested by tsutsui in ticket #1145):
sys/arch/hp300/stand/common/ite_tc.c: revision 1.6
sys/arch/hp300/stand/common/ite_gb.c: revision 1.6
sys/arch/hp300/stand/common/ite_rb.c: revision 1.6
sys/arch/hp300/stand/common/ite_hy.c: revision 1.6
sys/arch/hp300/stand/common/ite_dv.c: revision 1.6
Fix botch on ANSIfy.
 1.5.2.1 01-Feb-2006  yamt sync with head.
 1.6.106.2 17-Feb-2011  bouyer Sync with HEAD
 1.6.106.1 08-Feb-2011  bouyer Sync with HEAD
 1.6.104.1 06-Jun-2011  jruoho Sync with HEAD.
 1.6.98.1 05-Mar-2011  rmind sync with head
 1.10.92.1 02-Aug-2025  perseant Sync with HEAD
 1.11 27-May-2025  tsutsui Make local functions static.
 1.10 10-Feb-2011  tsutsui branches: 1.10.92;
Pull OpenBSD's standalone ITE driver reorganization:
- merge similar clear, putc, cursor, and scroll ops for all DIO framebuffers
- rename and move hyper_windowmove() to ite_dio_windowmove1bpp()
to use it among all dumb monochrome framebuffers
- ditto hyper_putc() to ite_dio_putc1bpp()
- remove unnecessary flags, macro, function args, and structure members
- remove trailing spaces and tabs

Also misc cosmetics to reduce diffs from OpenBSD,
and some KNF that generates diffs from OpenBSD.

Tested on HP382 and HP425t.
 1.9 10-Feb-2011  tsutsui Move and renamve hyper_ite_fontinit() to ite_fontinit1bpp() to share it
among all monochrome framebuffers. Also rename ite_fontinit() to
ite_fontinit8bpp(). From OpenBSD.
 1.8 08-Feb-2011  rmind Remove clause 3 (UCB advertising clause) from the University of Utah
copyright. Confirmed by Mike Hibler, mike at cs.utah.edu - thanks!
Also, merge UCB and Utah copyright texts back into one, as they
originally were.

Extra verification by snj@.
 1.7 07-Feb-2011  tsutsui Resurrect and move retired ITE files that are still used by bootloaders.
 1.6 28-Jan-2006  tsutsui branches: 1.6.98; 1.6.104; 1.6.106;
Fix botch on ANSIfy.
 1.5 11-Dec-2005  christos branches: 1.5.2;
merge ktrace-lwp.
 1.4 20-Feb-2005  tsutsui branches: 1.4.2; 1.4.4; 1.4.12;
Use ANSI function decls.
 1.3 14-Nov-2003  tsutsui branches: 1.3.8; 1.3.10;
Misc cleanup:
- KNF
- WARNSfy
- remove __P()
- remove register declarations
- const'ify some variables
- make some local functions/variables static
- bcopy -> memcpy
- bcmp -> memcmp
- bzero -> memset
- space/TAB fix
etc.
 1.2 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.1 04-Feb-1997  thorpej branches: 1.1.60;
Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.1.60.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.1.60.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.60.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.60.1 03-Aug-2004  skrll Sync with HEAD
 1.3.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.3.8.1 29-Apr-2005  kent sync with -current
 1.4.12.1 30-Jan-2006  tron Pull up following revision(s) (requested by tsutsui in ticket #1145):
sys/arch/hp300/stand/common/ite_tc.c: revision 1.6
sys/arch/hp300/stand/common/ite_gb.c: revision 1.6
sys/arch/hp300/stand/common/ite_rb.c: revision 1.6
sys/arch/hp300/stand/common/ite_hy.c: revision 1.6
sys/arch/hp300/stand/common/ite_dv.c: revision 1.6
Fix botch on ANSIfy.
 1.4.4.1 21-Jun-2006  yamt sync with head.
 1.4.2.1 30-Jan-2006  tron Pull up following revision(s) (requested by tsutsui in ticket #1145):
sys/arch/hp300/stand/common/ite_tc.c: revision 1.6
sys/arch/hp300/stand/common/ite_gb.c: revision 1.6
sys/arch/hp300/stand/common/ite_rb.c: revision 1.6
sys/arch/hp300/stand/common/ite_hy.c: revision 1.6
sys/arch/hp300/stand/common/ite_dv.c: revision 1.6
Fix botch on ANSIfy.
 1.5.2.1 01-Feb-2006  yamt sync with head.
 1.6.106.2 17-Feb-2011  bouyer Sync with HEAD
 1.6.106.1 08-Feb-2011  bouyer Sync with HEAD
 1.6.104.1 06-Jun-2011  jruoho Sync with HEAD.
 1.6.98.1 05-Mar-2011  rmind sync with head
 1.10.92.1 02-Aug-2025  perseant Sync with HEAD
 1.12 10-Feb-2011  tsutsui Pull OpenBSD's standalone ITE driver reorganization:
- merge similar clear, putc, cursor, and scroll ops for all DIO framebuffers
- rename and move hyper_windowmove() to ite_dio_windowmove1bpp()
to use it among all dumb monochrome framebuffers
- ditto hyper_putc() to ite_dio_putc1bpp()
- remove unnecessary flags, macro, function args, and structure members
- remove trailing spaces and tabs

Also misc cosmetics to reduce diffs from OpenBSD,
and some KNF that generates diffs from OpenBSD.

Tested on HP382 and HP425t.
 1.11 10-Feb-2011  tsutsui Move and renamve hyper_ite_fontinit() to ite_fontinit1bpp() to share it
among all monochrome framebuffers. Also rename ite_fontinit() to
ite_fontinit8bpp(). From OpenBSD.
 1.10 08-Feb-2011  rmind Remove clause 3 (UCB advertising clause) from the University of Utah
copyright. Confirmed by Mike Hibler, mike at cs.utah.edu - thanks!
Also, merge UCB and Utah copyright texts back into one, as they
originally were.

Extra verification by snj@.
 1.9 07-Feb-2011  tsutsui Resurrect and move retired ITE files that are still used by bootloaders.
 1.8 07-Mar-2007  he branches: 1.8.66; 1.8.72; 1.8.74;
Fix an instance of "void *v, x;" and cast to char* before doing
pointer arithmetic.
 1.7 19-Mar-2006  tsutsui branches: 1.7.14;
Add trailing semicolons to some macroes which have been changed
using do{}while(/*CONSTCOND*/0) statements.
 1.6 28-Jan-2006  tsutsui branches: 1.6.2; 1.6.4; 1.6.6; 1.6.8; 1.6.10;
Fix botch on ANSIfy.
 1.5 11-Dec-2005  christos branches: 1.5.2;
merge ktrace-lwp.
 1.4 20-Feb-2005  tsutsui branches: 1.4.2; 1.4.4; 1.4.12;
Use ANSI function decls.
 1.3 14-Nov-2003  tsutsui branches: 1.3.8; 1.3.10;
Misc cleanup:
- KNF
- WARNSfy
- remove __P()
- remove register declarations
- const'ify some variables
- make some local functions/variables static
- bcopy -> memcpy
- bcmp -> memcmp
- bzero -> memset
- space/TAB fix
etc.
 1.2 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.1 04-Feb-1997  thorpej branches: 1.1.60;
Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.1.60.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.1.60.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.60.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.60.1 03-Aug-2004  skrll Sync with HEAD
 1.3.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.3.8.1 29-Apr-2005  kent sync with -current
 1.4.12.1 30-Jan-2006  tron Pull up following revision(s) (requested by tsutsui in ticket #1145):
sys/arch/hp300/stand/common/ite_tc.c: revision 1.6
sys/arch/hp300/stand/common/ite_gb.c: revision 1.6
sys/arch/hp300/stand/common/ite_rb.c: revision 1.6
sys/arch/hp300/stand/common/ite_hy.c: revision 1.6
sys/arch/hp300/stand/common/ite_dv.c: revision 1.6
Fix botch on ANSIfy.
 1.4.4.2 03-Sep-2007  yamt sync with head.
 1.4.4.1 21-Jun-2006  yamt sync with head.
 1.4.2.1 30-Jan-2006  tron Pull up following revision(s) (requested by tsutsui in ticket #1145):
sys/arch/hp300/stand/common/ite_tc.c: revision 1.6
sys/arch/hp300/stand/common/ite_gb.c: revision 1.6
sys/arch/hp300/stand/common/ite_rb.c: revision 1.6
sys/arch/hp300/stand/common/ite_hy.c: revision 1.6
sys/arch/hp300/stand/common/ite_dv.c: revision 1.6
Fix botch on ANSIfy.
 1.5.2.1 01-Feb-2006  yamt sync with head.
 1.6.10.1 28-Mar-2006  tron Merge 2006-03-28 NetBSD-current into the "peter-altq" branch.
 1.6.8.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.6.6.1 01-Apr-2006  yamt sync with head.
 1.6.4.1 22-Apr-2006  simonb Sync with head.
 1.6.2.1 09-Sep-2006  rpaulo sync with head
 1.7.14.1 12-Mar-2007  rmind Sync with HEAD.
 1.8.74.2 17-Feb-2011  bouyer Sync with HEAD
 1.8.74.1 08-Feb-2011  bouyer Sync with HEAD
 1.8.72.1 06-Jun-2011  jruoho Sync with HEAD.
 1.8.66.1 05-Mar-2011  rmind sync with head
 1.12 27-May-2025  tsutsui Make local functions static.
 1.11 10-Feb-2011  tsutsui branches: 1.11.92;
Pull OpenBSD's standalone ITE driver reorganization:
- merge similar clear, putc, cursor, and scroll ops for all DIO framebuffers
- rename and move hyper_windowmove() to ite_dio_windowmove1bpp()
to use it among all dumb monochrome framebuffers
- ditto hyper_putc() to ite_dio_putc1bpp()
- remove unnecessary flags, macro, function args, and structure members
- remove trailing spaces and tabs

Also misc cosmetics to reduce diffs from OpenBSD,
and some KNF that generates diffs from OpenBSD.

Tested on HP382 and HP425t.
 1.10 10-Feb-2011  tsutsui Move and renamve hyper_ite_fontinit() to ite_fontinit1bpp() to share it
among all monochrome framebuffers. Also rename ite_fontinit() to
ite_fontinit8bpp(). From OpenBSD.
 1.9 08-Feb-2011  rmind Remove clause 3 (UCB advertising clause) from the University of Utah
copyright. Confirmed by Mike Hibler, mike at cs.utah.edu - thanks!
Also, merge UCB and Utah copyright texts back into one, as they
originally were.

Extra verification by snj@.
 1.8 07-Feb-2011  tsutsui Resurrect and move retired ITE files that are still used by bootloaders.
 1.7 07-Mar-2007  he branches: 1.7.66; 1.7.72; 1.7.74;
Fix an instance of "void *v, x;" and cast to char* before doing
pointer arithmetic.
 1.6 28-Jan-2006  tsutsui branches: 1.6.24;
Fix botch on ANSIfy.
 1.5 11-Dec-2005  christos branches: 1.5.2;
merge ktrace-lwp.
 1.4 20-Feb-2005  tsutsui branches: 1.4.2; 1.4.4; 1.4.12;
Use ANSI function decls.
 1.3 14-Nov-2003  tsutsui branches: 1.3.8; 1.3.10;
Misc cleanup:
- KNF
- WARNSfy
- remove __P()
- remove register declarations
- const'ify some variables
- make some local functions/variables static
- bcopy -> memcpy
- bcmp -> memcmp
- bzero -> memset
- space/TAB fix
etc.
 1.2 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.1 04-Feb-1997  thorpej branches: 1.1.60;
Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.1.60.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.1.60.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.60.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.60.1 03-Aug-2004  skrll Sync with HEAD
 1.3.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.3.8.1 29-Apr-2005  kent sync with -current
 1.4.12.1 30-Jan-2006  tron Pull up following revision(s) (requested by tsutsui in ticket #1145):
sys/arch/hp300/stand/common/ite_tc.c: revision 1.6
sys/arch/hp300/stand/common/ite_gb.c: revision 1.6
sys/arch/hp300/stand/common/ite_rb.c: revision 1.6
sys/arch/hp300/stand/common/ite_hy.c: revision 1.6
sys/arch/hp300/stand/common/ite_dv.c: revision 1.6
Fix botch on ANSIfy.
 1.4.4.2 03-Sep-2007  yamt sync with head.
 1.4.4.1 21-Jun-2006  yamt sync with head.
 1.4.2.1 30-Jan-2006  tron Pull up following revision(s) (requested by tsutsui in ticket #1145):
sys/arch/hp300/stand/common/ite_tc.c: revision 1.6
sys/arch/hp300/stand/common/ite_gb.c: revision 1.6
sys/arch/hp300/stand/common/ite_rb.c: revision 1.6
sys/arch/hp300/stand/common/ite_hy.c: revision 1.6
sys/arch/hp300/stand/common/ite_dv.c: revision 1.6
Fix botch on ANSIfy.
 1.5.2.1 01-Feb-2006  yamt sync with head.
 1.6.24.1 12-Mar-2007  rmind Sync with HEAD.
 1.7.74.2 17-Feb-2011  bouyer Sync with HEAD
 1.7.74.1 08-Feb-2011  bouyer Sync with HEAD
 1.7.72.1 06-Jun-2011  jruoho Sync with HEAD.
 1.7.66.1 05-Mar-2011  rmind sync with head
 1.11.92.1 02-Aug-2025  perseant Sync with HEAD
 1.6 29-May-2025  tsutsui Consolidate scroll and cursor drawing ops into common ITE layer.

No functional change, just for readability.
Tested on 380 (topcat) and 382 (sti).
 1.5 27-May-2025  tsutsui Make local functions static.
 1.4 27-May-2025  tsutsui Make sure to erase cursor before scrolling as ite_dio_scroll() does.

Fixes garbages on scrolling on sti bootloader console.
 1.3 26-May-2025  tsutsui Also use sti(4) ROM functions for 362/382 framebuffers on bootloader.

Mostly taken on OpenBSD/hp300.
Tested on 382 with VGA-res EVRX, and no visible regression on
425e (sti EVRX), 425t (sti CRX), and 380 (topcat).
 1.2 15-Jan-2023  tsutsui branches: 1.2.6;
TAB/space cleanup.
 1.1 13-Apr-2014  tsutsui branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8; 1.1.12; 1.1.68;
Add sti(4) at sgc screen console support. From (the late) OpenBSD/hp300.

Tested on HP9000/425e, which was sent from Miod Vallat and
demonstrated at Open Source unConference 2014 Kagawa.
 1.1.68.1 22-Jun-2024  martin Pull up following revision(s) (requested by tsutsui in ticket #722):

sys/fs/cd9660/cd9660_util.c: revision 1.16
sys/arch/hp300/stand/common/clock.c: revision 1.14
sys/arch/hp300/stand/common/scsireg.h: revision 1.5
sys/arch/hp300/stand/common/scsireg.h: revision 1.6
sys/arch/hp300/stand/Makefile.buildboot: revision 1.38
sys/arch/hp300/include/bus.h: revision 1.23
sys/arch/hp300/stand/Makefile.buildboot: revision 1.39
sys/arch/hp300/stand/common/sd.c: revision 1.12
sys/arch/hp300/stand/common/prf.c: revision 1.6
sys/arch/hp300/stand/common/sd.c: revision 1.13
usr.sbin/installboot/installboot.8: revision 1.106
usr.sbin/installboot/Makefile: revision 1.59
sys/arch/hp300/stand/common/devopen.c: revision 1.14
usr.sbin/installboot/installboot.8: revision 1.107
sys/arch/hp300/stand/common/ite_dumb.c: revision 1.2
sys/arch/hp300/stand/common/devopen.c: revision 1.15
usr.sbin/installboot/installboot.8: revision 1.108
sys/fs/cd9660/cd9660_extern.h: revision 1.29
usr.sbin/installboot/installboot.8: revision 1.109
tools/Makefile.nbincludes: revision 1.11 (patch)
sys/arch/hp300/dev/rboxreg.h: revision 1.3
sys/arch/hp300/stand/common/scsivar.h: revision 1.5
sys/arch/hp300/dev/dnkbd.c: revision 1.14
sys/arch/hp300/hp300/trap.c: revision 1.156
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.12
sys/arch/hp300/dev/frodoreg.h: revision 1.6
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.13
sys/arch/hp300/stand/common/ite_sti.c: revision 1.2
sys/arch/hp300/stand/common/hil.c: revision 1.15
usr.sbin/installboot/arch/hp300.c: revision 1.18
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.14
sys/arch/hp300/dev/rbox.c: revision 1.4
usr.sbin/installboot/arch/hp300.c: revision 1.19
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.15
sys/sys/bootblock.h: revision 1.59
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.16
usr.sbin/installboot/installboot.h: revision 1.44
sys/arch/hp300/stand/mkboot/volhdr.h: file removal
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.17
sys/arch/hp300/dev/hpib.c: revision 1.45
usr.sbin/installboot/installboot.h: revision 1.45
usr.sbin/installboot/cd9660.c: revision 1.1
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.18
sys/arch/hp300/dev/topcatreg.h: revision 1.3
usr.sbin/installboot/cd9660.c: revision 1.2
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.19
sys/arch/hp300/stand/inst/inst.c: revision 1.25
sys/arch/hp300/stand/uboot/Makefile: revision 1.12
sys/arch/hp300/dev/dvbox.c: revision 1.4
sys/arch/hp300/dev/dma.c: revision 1.45
sys/arch/hp300/stand/uboot/Makefile: revision 1.13
sys/arch/hp300/stand/common/rd.c: revision 1.16
sys/arch/hp300/stand/inst/Makefile: revision 1.12
distrib/hp300/cdroms/installcd/Makefile: revision 1.4
sys/arch/hp300/stand/mkboot/volhdr.h: revision 1.6
sys/arch/hp300/stand/common/machdep.c: revision 1.16
usr.sbin/installboot/fstypes.c: revision 1.14
sys/arch/hp300/hp300/machdep.c: revision 1.238
sys/arch/hp300/include/cpu.h: revision 1.73
sys/arch/hp300/dev/diofbreg.h: revision 1.4
sys/arch/hp300/stand/common/scsi.c: revision 1.12
sys/arch/hp300/stand/common/netio.c: revision 1.19
sys/arch/hp300/stand/common/scsi.c: revision 1.13
sys/arch/hp300/dev/sti_sgc.c: revision 1.8
sys/arch/hp300/dev/rtc.c: revision 1.22
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.20
sys/arch/hp300/stand/common/conf.h: revision 1.4
sys/arch/hp300/hp300/autoconf.c: revision 1.111
sys/arch/hp300/stand/common/conf.c: revision 1.15
sys/arch/hp300/stand/mkboot/Makefile: revision 1.12
sys/arch/hp300/stand/mkboot/Makefile: revision 1.13
sys/arch/hp300/hp300/autoconf.c: revision 1.114
sys/arch/hp300/dev/dcmreg.h: revision 1.11
sys/arch/hp300/dev/diofbvar.h: revision 1.4
sys/arch/hp300/dev/dcm.c: revision 1.91
sys/fs/cd9660/cd9660_util.c: revision 1.15
sys/arch/hp300/dev/mcclock_frodo.c: revision 1.2

TAB/space cleanup.

installboot(8): formatting improvements

Use Ar foo instead of <foo>; this is mdoc.

Other formatting tweaks.
installboot(8): fix up markup

Don't overuse .Sy - when everything is highlighted, nothing is. Use
.Ic for options &c to get correct PostScript output (both are bold in
plain text).

Use Aq Ar inside .Pa, as both Pa and Ar are rendered as underscored
text in plain text output, and the distinction is lost.

Don't set examples in bold, but give them .Pp space around - they are
much easier to read this way.

Use consistent -width in FILES.
document how to use installboot on netbsd/vax.

PR/57909: Jan-Benedict Glaw: Don't include (build) timestamp when doing a
reproducible build
fix usage string, improve error handling.
add missing chunk for repro-build. fix gcc warnings.
avoid stringop truncation, fix copyright string to prevent assembler warnings.

Fix build as a tool (Jan-Benedict Glaw)

Fix integer overflow of strtol(3) for "loadpoint" address on ILP32 hosts.

This strtol(3) was introduced in rev 1.12 for PR/57909 after netbsd-10,
but it returns LONG_MAX (0x7FFFFFFF) for 0xFFF00000 on ILP32 hosts and
the wrong loadpoint causes "NOT ENOUGH MEMORY" error by the BOOTROMs
on loading uboot.lif on (at least) my 9000/360 and 9000/425t.

Misc cosmetic changes for mostly readability.
- KNF and add some newlines per blocks
- define and use proper bintobcd() macro
- make local functions and variables static

The same uboot.lif binaries are generated.

Rename ${PROGAOUT} -> ${PROGELF} to reflect reality.
Use proper signedness for the LIF file system data structures.

Ancient 4.3BSD used short and int for location, file size, file type,
and addresses etc. but all of them should be unsigned.

Also rename several variables and add comments for readability.
The LIF file system info can be found in "The HPDir Project" page:
https://www.hp9845.net/9845/projects/hpdir/
The same uboot.lif binaries are generated.

Add a preliminary CD boot support to uboot for preparation of PR/54455.
Briefly tested on mame, but not enalbed yet.

Recognize SCSI CD-ROM devices as a booted device properly.

Necessary for PR port-hp300/54455, to boot an md root root RAMDISK

kernel from CD-ROM without "WARNING: can't find match for bootdev:"
prompt.

Sync with src/sys/arch/hp300/stand/mkboot/volhdr.h rev 1.6.
https://mail-index.netbsd.org/source-changes/2024/05/07/msg151195.html

Use proper signedness for the LIF file system data structures.
mkboot should use this MI <sys/bootblock.h> and volhdr.h should
be removed soon.

Use MI <sys/bootblock.h> to refer LIF filesystem structures.
This should have been done when LIF definitions were initially added
to <sys/bootblock.h> for MI installboot(8).

Enable SUPPORT_CD on uboot.

Make cd9660_util.c usable in userland tools like installboot(8).

This was partially done for src/distrib/cdrom/macppc_installboot,
but more strict prototypes are necessary for native binary builds.

Install cd9660 related system headers for tools installboot(8) builds.

Reorder function prototypes per source files.

Add cd9660 support to search a bootloader file in the target file system.

Also add CD boot support for hp300, using a bootloader file in cd9660 fs.
This is a tool's part to close PR/54455.

HP 9000/300 machines read LIF directory entry allocated after
the LIF volume header at the top of the boot disk during bootstrap,
and a bootstrap file must be contiguously allocated on the disk
due to limitation of the LIF specification.

Current NetBSD/hp300's bootloader is larger than ~80KB so we have
to prepare a special 'boot' partition for FFS (that has only 8KB (ffsv1)
or 32KB (ffsv2) spaces) disks to put such a large bootloader.

On the other hand, on ISO9660 fs all files are allocated contiguously
so we can specify a bootloader file in the target ISO9660 directly
in the LIF directory entry.

Note we can simply use the existing "append" option to create bootable
CD ISO for hp300, but it looks some emulators (at leaset MAME) reject
such non-standard ISO files, i.e. with an appended bootloader file at
the end of the image.

Put a RAMDISK kernel and SYS_UBOOT into hp300 installcd to make it bootable.

This should finally close PR/54455.

Fix tools build errors on Cygwin.

Appease warnings on building tools/installboot on Cygwin.
 1.1.12.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.12.1 13-Apr-2014  tls file ite_sti.c was added on branch tls-maxphys on 2014-08-20 00:03:01 +0000
 1.1.8.2 10-Aug-2014  tls Rebase.
 1.1.8.1 13-Apr-2014  tls file ite_sti.c was added on branch tls-earlyentropy on 2014-08-10 06:53:58 +0000
 1.1.6.2 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.1.6.1 13-Apr-2014  yamt file ite_sti.c was added on branch yamt-pagecache on 2014-05-22 11:39:47 +0000
 1.1.4.2 21-May-2014  bouyer Pull up following revision(s) (requested by tsutsui in ticket #1058):
sys/arch/hp300/conf/files.hp300: revision 1.88
sys/arch/hp300/include/autoconf.h: revision 1.13
sys/dev/ic/sti.c: revision 1.17
sys/arch/hp300/dev/frodo.c: revision 1.31
sys/arch/hp300/conf/GENERIC: revision 1.173
sys/arch/hp300/hp300/machdep.c: revision 1.229
sys/arch/hp300/dev/frodo.c: revision 1.32
sys/arch/hp300/hp300/autoconf.c: revision 1.102
sys/arch/hp300/dev/frodoreg.h: revision 1.5
sys/arch/hp300/stand/common/ite_sti.c: revision 1.1
sys/arch/hp300/stand/common/itevar.h: revision 1.16
sys/arch/hp300/hp300/autoconf.c: revision 1.105
sys/arch/hp300/dev/sti_sgcvar.h: revision 1.1
sys/arch/hp300/stand/common/apci.c: revision 1.12
sys/arch/hp300/stand/common/apci.c: revision 1.13
sys/arch/hp300/dev/dnkbd.c: revision 1.6
sys/arch/hp300/dev/dnkbd.c: revision 1.7
sys/arch/hp300/stand/inst/version: revision 1.12
sys/arch/hp300/dev/com_frodo.c: revision 1.9
sys/arch/hp300/stand/common/ite.c: revision 1.17
sys/arch/hp300/conf/GENERIC: revision 1.181
sys/arch/hp300/dev/sti_sgc.c: revision 1.1
sys/arch/hp300/stand/common/dnkbd.c: revision 1.13
sys/arch/hp300/dev/sti_sgc.c: revision 1.2
sys/dev/ic/stivar.h: revision 1.8
sys/arch/hp300/dev/rtc.c: revision 1.21
sys/arch/hp300/conf/INSTALL: revision 1.56
sys/arch/hp300/conf/INSTALL: revision 1.58
sys/arch/hp300/stand/uboot/version: revision 1.19
sys/arch/hp300/stand/common/samachdep.h: revision 1.17
sys/arch/hp300/stand/common/clock.c: revision 1.12
sys/arch/hp300/dev/mcclock_frodo.c: revision 1.1
sys/arch/hp300/stand/Makefile.buildboot: revision 1.34
sys/arch/hp300/conf/files.hp300: revision 1.87
Add sti at sgc framebuffer.
Ported from OpenBSD by kiyohara@.
Fix a botch on switching from apci (and dca) to MI com(4) 10 years ago.
I.e. fix apci device address per FRODO_BASE macro change
in frodoreg.h rev 1.2. Now bootloader works with serial console
on HP425e (which has only com at frodo).
Thanks to miod@openbsd for providing his 425e.
Add sti(4) at sgc screen console support. From (the late) OpenBSD/hp300.
Tested on HP9000/425e, which was sent from Miod Vallat and
demonstrated at Open Source unConference 2014 Kagawa.
Check the service switch on 425e to select apci serial console.
Taken from OpenBSD/hp300. See the following comment for details:
> * Check the service switch. On the 425e, this is a physical
> * switch, unlike other frodo-based machines, so we can use it
> * as a serial vs internal video selector, since the PROM can not
> * be configured for serial console.
Add proper RealTime Clock support for HP9000/425e.
As the OpenBSD/hp300 page says 425e doesn't have the traditional
RTC at intio (as it also lacks DCA 16550 serial at intio?),
but after a few hour investigation it turns out that
425e uses mc146818 compatible calendar clock in
the Apollo "frodo" utility chip and the frodo chip on
425e actually has the 32kHz OSC and is actually backed up
by the onboard lithium battery.
Tested on HP425e (with mcclock) and HP362 (with old rtc).
Add RTC support for HP9000/425e to bootloader too.
Also put several cleanup:
- make local functions and variables static
- use proper variable types
- some KNF
Note it turns out that extreme slowness of netboot on hp300 is
caused by the too slow access of the traditional RTC chip at intio
(i.e. netboot on 425e is so much faster than others). Oh well.
Add proper consinit(9) support for sti(4) at sgc framebuffer on hp300.
The cnattach functions for sti(4) and service switch check method
for 425e in com_frodo.c are taken from OpenBSD.
The strategy how to choose the console device in hp300_cninit() is
quite diverged from 4.4BSD and OpenBSD so it's tweaked by me.
Also put several changes in sti_sgc.c to reduce diffs from OpenBSD/hp300.
Tested on 425e and 362 (which still uses gendiofb(4), not sti(4)).
XXX: sti(4) requires uvm_km_alloc(9) and uvm_map_protect(9)
to copy and call ROM functions on the executable memory region, so
it can be called before UVM and related initializations are complete.
Probably it's time to consider about MI "deferred consinit()" API
in init_main.c (or elsewhere) for modern complicated VM system...
Also fix the apci device address in dnkbd.c as apci.c rev 1.12:
http://mail-index.netbsd.org/source-changes/2014/04/10/msg053940.html
Finally dnkbd(4) is confirmed working at least on bootloader.
Thanks again to Miod Vallat.
Make the Apollo Domain keyboard actually work.
Tested on HP9000/425e and the keyboard model A1630-82001 R2 (RX-60857-HW)
provided by Miod Vallat. Mouse support needs more work.
Pull random notes on the Apollo Domain keyboard from ancient PR/3528.
Bump versions to denote recent 425e related changes.
Probe mcclock only on 425e to avoid an extra "not configured" message.
Add and enable sti(4) at sgc in install kernels for 425e.
Tested on both serial console and framebuffer console.
(switched by the service switch on the back panel)
 1.1.4.1 13-Apr-2014  bouyer file ite_sti.c was added on branch netbsd-6 on 2014-05-21 20:56:36 +0000
 1.1.2.2 18-May-2014  rmind sync with head
 1.1.2.1 13-Apr-2014  rmind file ite_sti.c was added on branch rmind-smpnet on 2014-05-18 17:45:08 +0000
 1.2.6.1 02-Aug-2025  perseant Sync with HEAD
 1.13 31-May-2025  tsutsui More cleanup and cosmetics in bootloader 1bpp ite sources.

- use C99 exact width integer types where appropriate
- make local variables static and read only variables const
- misc KNF

No visible regression on HP9000/380 with 1bpp DIO-II Hyperion.
 1.12 29-May-2025  tsutsui Consolidate scroll and cursor drawing ops into common ITE layer.

No functional change, just for readability.
Tested on 380 (topcat) and 382 (sti).
 1.11 12-Feb-2011  tsutsui branches: 1.11.92;
Add dumb framebuffer (no acceleration, no colormap) support
for HP362 and HP382.

Tested on A1473-69510 (HP362 VGA-res) and A1474-69511 (HP382 mid-res).
 1.10 10-Feb-2011  tsutsui Pull OpenBSD's standalone ITE driver reorganization:
- merge similar clear, putc, cursor, and scroll ops for all DIO framebuffers
- rename and move hyper_windowmove() to ite_dio_windowmove1bpp()
to use it among all dumb monochrome framebuffers
- ditto hyper_putc() to ite_dio_putc1bpp()
- remove unnecessary flags, macro, function args, and structure members
- remove trailing spaces and tabs

Also misc cosmetics to reduce diffs from OpenBSD,
and some KNF that generates diffs from OpenBSD.

Tested on HP382 and HP425t.
 1.9 10-Feb-2011  tsutsui Move and renamve hyper_ite_fontinit() to ite_fontinit1bpp() to share it
among all monochrome framebuffers. Also rename ite_fontinit() to
ite_fontinit8bpp(). From OpenBSD.
 1.8 10-Feb-2011  tsutsui All framebuffer drivers use common readbyte and writeglyph functions
so no need to put them into per driver function pointers. From OpenBSD.

Tested on HP382 (serial) and HP425t (topcat).
 1.7 08-Feb-2011  rmind Remove clause 3 (UCB advertising clause) from the University of Utah
copyright. Confirmed by Mike Hibler, mike at cs.utah.edu - thanks!
Also, merge UCB and Utah copyright texts back into one, as they
originally were.

Extra verification by snj@.
 1.6 07-Feb-2011  tsutsui Resurrect and move retired ITE files that are still used by bootloaders.
 1.5 11-Dec-2005  christos branches: 1.5.100; 1.5.106; 1.5.108;
merge ktrace-lwp.
 1.4 20-Feb-2005  tsutsui Use ANSI function decls.
 1.3 14-Nov-2003  tsutsui branches: 1.3.8; 1.3.10;
Misc cleanup:
- KNF
- WARNSfy
- remove __P()
- remove register declarations
- const'ify some variables
- make some local functions/variables static
- bcopy -> memcpy
- bcmp -> memcmp
- bzero -> memset
- space/TAB fix
etc.
 1.2 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.1 04-Feb-1997  thorpej branches: 1.1.60;
Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.1.60.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.1.60.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.60.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.60.1 03-Aug-2004  skrll Sync with HEAD
 1.3.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.3.8.1 29-Apr-2005  kent sync with -current
 1.5.108.2 17-Feb-2011  bouyer Sync with HEAD
 1.5.108.1 08-Feb-2011  bouyer Sync with HEAD
 1.5.106.1 06-Jun-2011  jruoho Sync with HEAD.
 1.5.100.1 05-Mar-2011  rmind sync with head
 1.11.92.1 02-Aug-2025  perseant Sync with HEAD
 1.12 27-May-2025  tsutsui Make local functions static.
 1.11 05-Jul-2021  tsutsui branches: 1.11.16;
Get rid of obsolete grfreg.h. From OpenBSD.
 1.10 10-Feb-2011  tsutsui branches: 1.10.72;
Pull OpenBSD's standalone ITE driver reorganization:
- merge similar clear, putc, cursor, and scroll ops for all DIO framebuffers
- rename and move hyper_windowmove() to ite_dio_windowmove1bpp()
to use it among all dumb monochrome framebuffers
- ditto hyper_putc() to ite_dio_putc1bpp()
- remove unnecessary flags, macro, function args, and structure members
- remove trailing spaces and tabs

Also misc cosmetics to reduce diffs from OpenBSD,
and some KNF that generates diffs from OpenBSD.

Tested on HP382 and HP425t.
 1.9 10-Feb-2011  tsutsui Move and renamve hyper_ite_fontinit() to ite_fontinit1bpp() to share it
among all monochrome framebuffers. Also rename ite_fontinit() to
ite_fontinit8bpp(). From OpenBSD.
 1.8 08-Feb-2011  rmind Remove clause 3 (UCB advertising clause) from the University of Utah
copyright. Confirmed by Mike Hibler, mike at cs.utah.edu - thanks!
Also, merge UCB and Utah copyright texts back into one, as they
originally were.

Extra verification by snj@.
 1.7 07-Feb-2011  tsutsui Resurrect and move retired ITE files that are still used by bootloaders.
 1.6 28-Jan-2006  tsutsui branches: 1.6.98; 1.6.104; 1.6.106;
Fix botch on ANSIfy.
 1.5 11-Dec-2005  christos branches: 1.5.2;
merge ktrace-lwp.
 1.4 20-Feb-2005  tsutsui branches: 1.4.2; 1.4.4; 1.4.12;
Use ANSI function decls.
 1.3 14-Nov-2003  tsutsui branches: 1.3.8; 1.3.10;
Misc cleanup:
- KNF
- WARNSfy
- remove __P()
- remove register declarations
- const'ify some variables
- make some local functions/variables static
- bcopy -> memcpy
- bcmp -> memcmp
- bzero -> memset
- space/TAB fix
etc.
 1.2 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.1 04-Feb-1997  thorpej branches: 1.1.60;
Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.1.60.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.1.60.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.60.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.60.1 03-Aug-2004  skrll Sync with HEAD
 1.3.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.3.8.1 29-Apr-2005  kent sync with -current
 1.4.12.1 30-Jan-2006  tron Pull up following revision(s) (requested by tsutsui in ticket #1145):
sys/arch/hp300/stand/common/ite_tc.c: revision 1.6
sys/arch/hp300/stand/common/ite_gb.c: revision 1.6
sys/arch/hp300/stand/common/ite_rb.c: revision 1.6
sys/arch/hp300/stand/common/ite_hy.c: revision 1.6
sys/arch/hp300/stand/common/ite_dv.c: revision 1.6
Fix botch on ANSIfy.
 1.4.4.1 21-Jun-2006  yamt sync with head.
 1.4.2.1 30-Jan-2006  tron Pull up following revision(s) (requested by tsutsui in ticket #1145):
sys/arch/hp300/stand/common/ite_tc.c: revision 1.6
sys/arch/hp300/stand/common/ite_gb.c: revision 1.6
sys/arch/hp300/stand/common/ite_rb.c: revision 1.6
sys/arch/hp300/stand/common/ite_hy.c: revision 1.6
sys/arch/hp300/stand/common/ite_dv.c: revision 1.6
Fix botch on ANSIfy.
 1.5.2.1 01-Feb-2006  yamt sync with head.
 1.6.106.2 17-Feb-2011  bouyer Sync with HEAD
 1.6.106.1 08-Feb-2011  bouyer Sync with HEAD
 1.6.104.1 06-Jun-2011  jruoho Sync with HEAD.
 1.6.98.1 05-Mar-2011  rmind sync with head
 1.10.72.1 01-Aug-2021  thorpej Sync with HEAD.
 1.11.16.1 02-Aug-2025  perseant Sync with HEAD
 1.1 10-Feb-2011  tsutsui branches: 1.1.2; 1.1.4; 1.1.8;
Pull support for Tigershark monochrome framebuffer from OpenBSD.
Untested (no hardware), but doesn't break existing HP425t topcat.
 1.1.8.2 06-Jun-2011  jruoho Sync with HEAD.
 1.1.8.1 10-Feb-2011  jruoho file ite_tvrx.c was added on branch jruoho-x86intr on 2011-06-06 09:05:38 +0000
 1.1.4.2 05-Mar-2011  rmind sync with head
 1.1.4.1 10-Feb-2011  rmind file ite_tvrx.c was added on branch rmind-uvmplock on 2011-03-05 20:50:25 +0000
 1.1.2.2 17-Feb-2011  bouyer Sync with HEAD
 1.1.2.1 10-Feb-2011  bouyer file ite_tvrx.c was added on branch bouyer-quota2 on 2011-02-17 11:59:41 +0000
 1.2 08-Feb-2011  rmind branches: 1.2.2; 1.2.6;
Remove clause 3 (UCB advertising clause) from the University of Utah
copyright. Confirmed by Mike Hibler, mike at cs.utah.edu - thanks!
Also, merge UCB and Utah copyright texts back into one, as they
originally were.

Extra verification by snj@.
 1.1 07-Feb-2011  tsutsui branches: 1.1.2;
Resurrect and move retired ITE files that are still used by bootloaders.
 1.1.2.3 17-Feb-2011  bouyer Sync with HEAD
 1.1.2.2 08-Feb-2011  bouyer Sync with HEAD
 1.1.2.1 07-Feb-2011  bouyer file itereg.h was added on branch bouyer-quota2 on 2011-02-08 16:19:23 +0000
 1.2.6.2 06-Jun-2011  jruoho Sync with HEAD.
 1.2.6.1 08-Feb-2011  jruoho file itereg.h was added on branch jruoho-x86intr on 2011-06-06 09:05:38 +0000
 1.2.2.2 05-Mar-2011  rmind sync with head
 1.2.2.1 08-Feb-2011  rmind file itereg.h was added on branch rmind-uvmplock on 2011-03-05 20:50:25 +0000
 1.18 30-May-2025  tsutsui Misc cleanup.

- make local variables static
- make read only variable const
- remove a redundant arg
- use uint8_t rather than u_char
- use consistent style
- some KNF
 1.17 26-May-2025  tsutsui Also use sti(4) ROM functions for 362/382 framebuffers on bootloader.

Mostly taken on OpenBSD/hp300.
Tested on 382 with VGA-res EVRX, and no visible regression on
425e (sti EVRX), 425t (sti CRX), and 380 (topcat).
 1.16 13-Apr-2014  tsutsui branches: 1.16.64;
Add sti(4) at sgc screen console support. From (the late) OpenBSD/hp300.

Tested on HP9000/425e, which was sent from Miod Vallat and
demonstrated at Open Source unConference 2014 Kagawa.
 1.15 12-Feb-2011  tsutsui branches: 1.15.4; 1.15.10; 1.15.14; 1.15.18; 1.15.28;
Add dumb framebuffer (no acceleration, no colormap) support
for HP362 and HP382.

Tested on A1473-69510 (HP362 VGA-res) and A1474-69511 (HP382 mid-res).
 1.14 10-Feb-2011  tsutsui Pull support for Tigershark monochrome framebuffer from OpenBSD.
Untested (no hardware), but doesn't break existing HP425t topcat.
 1.13 10-Feb-2011  tsutsui Pull OpenBSD's standalone ITE driver reorganization:
- merge similar clear, putc, cursor, and scroll ops for all DIO framebuffers
- rename and move hyper_windowmove() to ite_dio_windowmove1bpp()
to use it among all dumb monochrome framebuffers
- ditto hyper_putc() to ite_dio_putc1bpp()
- remove unnecessary flags, macro, function args, and structure members
- remove trailing spaces and tabs

Also misc cosmetics to reduce diffs from OpenBSD,
and some KNF that generates diffs from OpenBSD.

Tested on HP382 and HP425t.
 1.12 10-Feb-2011  tsutsui Remove unused deinit functions. From OpenBSD.
 1.11 10-Feb-2011  tsutsui Move and renamve hyper_ite_fontinit() to ite_fontinit1bpp() to share it
among all monochrome framebuffers. Also rename ite_fontinit() to
ite_fontinit8bpp(). From OpenBSD.
 1.10 10-Feb-2011  tsutsui bcopy() -> memmove()

How did this one survive several sweeps?
 1.9 10-Feb-2011  tsutsui All framebuffer drivers use common readbyte and writeglyph functions
so no need to put them into per driver function pointers. From OpenBSD.

Tested on HP382 (serial) and HP425t (topcat).
 1.8 08-Feb-2011  rmind Remove clause 3 (UCB advertising clause) from the University of Utah
copyright. Confirmed by Mike Hibler, mike at cs.utah.edu - thanks!
Also, merge UCB and Utah copyright texts back into one, as they
originally were.

Extra verification by snj@.
 1.7 18-Mar-2009  cegger branches: 1.7.4; 1.7.6; 1.7.8;
bzero -> memset
 1.6 07-Mar-2007  he branches: 1.6.44; 1.6.52; 1.6.58;
Fix an instance of "void *v, x;" and cast to char* before doing
pointer arithmetic.
 1.5 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.4 11-Dec-2005  christos branches: 1.4.26;
merge ktrace-lwp.
 1.3 14-Nov-2003  tsutsui branches: 1.3.16;
Misc cleanup:
- KNF
- WARNSfy
- remove __P()
- remove register declarations
- const'ify some variables
- make some local functions/variables static
- bcopy -> memcpy
- bcmp -> memcmp
- bzero -> memset
- space/TAB fix
etc.
 1.2 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.1 04-Feb-1997  thorpej branches: 1.1.60;
Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.1.60.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.60.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.60.1 03-Aug-2004  skrll Sync with HEAD
 1.3.16.1 03-Sep-2007  yamt sync with head.
 1.4.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.6.58.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.6.52.1 28-Apr-2009  skrll Sync with HEAD.
 1.6.44.1 04-May-2009  yamt sync with head.
 1.7.8.1 17-Feb-2011  bouyer Sync with HEAD
 1.7.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.7.4.1 05-Mar-2011  rmind sync with head
 1.15.28.1 10-Aug-2014  tls Rebase.
 1.15.18.1 18-May-2014  rmind sync with head
 1.15.14.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.15.10.1 21-May-2014  bouyer Pull up following revision(s) (requested by tsutsui in ticket #1058):
sys/arch/hp300/conf/files.hp300: revision 1.88
sys/arch/hp300/include/autoconf.h: revision 1.13
sys/dev/ic/sti.c: revision 1.17
sys/arch/hp300/dev/frodo.c: revision 1.31
sys/arch/hp300/conf/GENERIC: revision 1.173
sys/arch/hp300/hp300/machdep.c: revision 1.229
sys/arch/hp300/dev/frodo.c: revision 1.32
sys/arch/hp300/hp300/autoconf.c: revision 1.102
sys/arch/hp300/dev/frodoreg.h: revision 1.5
sys/arch/hp300/stand/common/ite_sti.c: revision 1.1
sys/arch/hp300/stand/common/itevar.h: revision 1.16
sys/arch/hp300/hp300/autoconf.c: revision 1.105
sys/arch/hp300/dev/sti_sgcvar.h: revision 1.1
sys/arch/hp300/stand/common/apci.c: revision 1.12
sys/arch/hp300/stand/common/apci.c: revision 1.13
sys/arch/hp300/dev/dnkbd.c: revision 1.6
sys/arch/hp300/dev/dnkbd.c: revision 1.7
sys/arch/hp300/stand/inst/version: revision 1.12
sys/arch/hp300/dev/com_frodo.c: revision 1.9
sys/arch/hp300/stand/common/ite.c: revision 1.17
sys/arch/hp300/conf/GENERIC: revision 1.181
sys/arch/hp300/dev/sti_sgc.c: revision 1.1
sys/arch/hp300/stand/common/dnkbd.c: revision 1.13
sys/arch/hp300/dev/sti_sgc.c: revision 1.2
sys/dev/ic/stivar.h: revision 1.8
sys/arch/hp300/dev/rtc.c: revision 1.21
sys/arch/hp300/conf/INSTALL: revision 1.56
sys/arch/hp300/conf/INSTALL: revision 1.58
sys/arch/hp300/stand/uboot/version: revision 1.19
sys/arch/hp300/stand/common/samachdep.h: revision 1.17
sys/arch/hp300/stand/common/clock.c: revision 1.12
sys/arch/hp300/dev/mcclock_frodo.c: revision 1.1
sys/arch/hp300/stand/Makefile.buildboot: revision 1.34
sys/arch/hp300/conf/files.hp300: revision 1.87
Add sti at sgc framebuffer.
Ported from OpenBSD by kiyohara@.
Fix a botch on switching from apci (and dca) to MI com(4) 10 years ago.
I.e. fix apci device address per FRODO_BASE macro change
in frodoreg.h rev 1.2. Now bootloader works with serial console
on HP425e (which has only com at frodo).
Thanks to miod@openbsd for providing his 425e.
Add sti(4) at sgc screen console support. From (the late) OpenBSD/hp300.
Tested on HP9000/425e, which was sent from Miod Vallat and
demonstrated at Open Source unConference 2014 Kagawa.
Check the service switch on 425e to select apci serial console.
Taken from OpenBSD/hp300. See the following comment for details:
> * Check the service switch. On the 425e, this is a physical
> * switch, unlike other frodo-based machines, so we can use it
> * as a serial vs internal video selector, since the PROM can not
> * be configured for serial console.
Add proper RealTime Clock support for HP9000/425e.
As the OpenBSD/hp300 page says 425e doesn't have the traditional
RTC at intio (as it also lacks DCA 16550 serial at intio?),
but after a few hour investigation it turns out that
425e uses mc146818 compatible calendar clock in
the Apollo "frodo" utility chip and the frodo chip on
425e actually has the 32kHz OSC and is actually backed up
by the onboard lithium battery.
Tested on HP425e (with mcclock) and HP362 (with old rtc).
Add RTC support for HP9000/425e to bootloader too.
Also put several cleanup:
- make local functions and variables static
- use proper variable types
- some KNF
Note it turns out that extreme slowness of netboot on hp300 is
caused by the too slow access of the traditional RTC chip at intio
(i.e. netboot on 425e is so much faster than others). Oh well.
Add proper consinit(9) support for sti(4) at sgc framebuffer on hp300.
The cnattach functions for sti(4) and service switch check method
for 425e in com_frodo.c are taken from OpenBSD.
The strategy how to choose the console device in hp300_cninit() is
quite diverged from 4.4BSD and OpenBSD so it's tweaked by me.
Also put several changes in sti_sgc.c to reduce diffs from OpenBSD/hp300.
Tested on 425e and 362 (which still uses gendiofb(4), not sti(4)).
XXX: sti(4) requires uvm_km_alloc(9) and uvm_map_protect(9)
to copy and call ROM functions on the executable memory region, so
it can be called before UVM and related initializations are complete.
Probably it's time to consider about MI "deferred consinit()" API
in init_main.c (or elsewhere) for modern complicated VM system...
Also fix the apci device address in dnkbd.c as apci.c rev 1.12:
http://mail-index.netbsd.org/source-changes/2014/04/10/msg053940.html
Finally dnkbd(4) is confirmed working at least on bootloader.
Thanks again to Miod Vallat.
Make the Apollo Domain keyboard actually work.
Tested on HP9000/425e and the keyboard model A1630-82001 R2 (RX-60857-HW)
provided by Miod Vallat. Mouse support needs more work.
Pull random notes on the Apollo Domain keyboard from ancient PR/3528.
Bump versions to denote recent 425e related changes.
Probe mcclock only on 425e to avoid an extra "not configured" message.
Add and enable sti(4) at sgc in install kernels for 425e.
Tested on both serial console and framebuffer console.
(switched by the service switch on the back panel)
 1.15.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.16.64.1 02-Aug-2025  perseant Sync with HEAD
 1.7 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.6 11-Dec-2005  christos branches: 1.6.74; 1.6.76; 1.6.78;
merge ktrace-lwp.
 1.5 20-Feb-2005  tsutsui Use ANSI function decls.
 1.4 14-Nov-2003  tsutsui branches: 1.4.8; 1.4.10;
Misc cleanup:
- KNF
- WARNSfy
- remove __P()
- remove register declarations
- const'ify some variables
- make some local functions/variables static
- bcopy -> memcpy
- bcmp -> memcmp
- bzero -> memset
- space/TAB fix
etc.
 1.3 09-Oct-1997  jtc branches: 1.3.50;
Fix tipo inherited from old version of TNF copyright template.
 1.2 12-May-1997  thorpej branches: 1.2.4;
In kbdnmi(), after we have cleared the interrupt condition, reset
the machine, rather than simply returning to the assembly NMI handler.
Previously, the assembly handler would simply jump back to begin:, which
would frob the stack, and re-clear the BSS. However, this is not sufficient,
as there may be state in initialized data that must be restored. Thus,
the only reasonable solution is to re-load the boot block.
 1.1 14-Apr-1997  thorpej Implement an autoconfiguring indirect keyboard driver, removing explcit
dependencies on the HIL keyboard.
 1.2.4.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.3.50.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.3.50.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.50.2 18-Sep-2004  skrll Sync with HEAD.
 1.3.50.1 03-Aug-2004  skrll Sync with HEAD
 1.4.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.4.8.1 29-Apr-2005  kent sync with -current
 1.6.78.1 16-May-2008  yamt sync with head.
 1.6.76.1 18-May-2008  yamt sync with head.
 1.6.74.1 02-Jun-2008  mjf Sync with HEAD.
 1.3 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.2 09-Oct-1997  jtc branches: 1.2.152; 1.2.154; 1.2.156;
Fix tipo inherited from old version of TNF copyright template.
 1.1 14-Apr-1997  thorpej branches: 1.1.4;
Implement an autoconfiguring indirect keyboard driver, removing explcit
dependencies on the HIL keyboard.
 1.1.4.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.2.156.1 16-May-2008  yamt sync with head.
 1.2.154.1 18-May-2008  yamt sync with head.
 1.2.152.1 02-Jun-2008  mjf Sync with HEAD.
 1.1 07-Feb-2011  tsutsui branches: 1.1.2; 1.1.4; 1.1.8;
Resurrect and move retired ITE files that are still used by bootloaders.
 1.1.8.2 06-Jun-2011  jruoho Sync with HEAD.
 1.1.8.1 07-Feb-2011  jruoho file kbdmap.h was added on branch jruoho-x86intr on 2011-06-06 09:05:38 +0000
 1.1.4.2 05-Mar-2011  rmind sync with head
 1.1.4.1 07-Feb-2011  rmind file kbdmap.h was added on branch rmind-uvmplock on 2011-03-05 20:50:25 +0000
 1.1.2.2 08-Feb-2011  bouyer Sync with HEAD
 1.1.2.1 07-Feb-2011  bouyer file kbdmap.h was added on branch bouyer-quota2 on 2011-02-08 16:19:23 +0000
 1.5 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.4 11-Dec-2005  christos branches: 1.4.74; 1.4.76; 1.4.78;
merge ktrace-lwp.
 1.3 14-Nov-2003  tsutsui Misc cleanup:
- KNF
- WARNSfy
- remove __P()
- remove register declarations
- const'ify some variables
- make some local functions/variables static
- bcopy -> memcpy
- bcmp -> memcmp
- bzero -> memset
- space/TAB fix
etc.
 1.2 09-Oct-1997  jtc branches: 1.2.50;
Fix tipo inherited from old version of TNF copyright template.
 1.1 14-Apr-1997  thorpej branches: 1.1.4;
Implement an autoconfiguring indirect keyboard driver, removing explcit
dependencies on the HIL keyboard.
 1.1.4.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.2.50.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.50.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.50.1 03-Aug-2004  skrll Sync with HEAD
 1.4.78.1 16-May-2008  yamt sync with head.
 1.4.76.1 18-May-2008  yamt sync with head.
 1.4.74.1 02-Jun-2008  mjf Sync with HEAD.
 1.16 15-Jan-2023  tsutsui TAB/space cleanup.
 1.15 08-Feb-2011  rmind branches: 1.15.86;
Remove clause 3 (UCB advertising clause) from the University of Utah
copyright. Confirmed by Mike Hibler, mike at cs.utah.edu - thanks!
Also, merge UCB and Utah copyright texts back into one, as they
originally were.

Extra verification by snj@.
 1.14 20-Jul-2006  tsutsui branches: 1.14.84; 1.14.90; 1.14.92;
Identify models HP362 and HP382. From OpenBSD, tested on my HP382.

Note now options HP362 and options HP382 are required for these models
in your kernel config file.
 1.13 11-Dec-2005  christos branches: 1.13.4; 1.13.8;
merge ktrace-lwp.
 1.12 20-Feb-2005  tsutsui branches: 1.12.4;
Use ANSI function decls.
 1.11 14-Nov-2003  tsutsui branches: 1.11.8; 1.11.10;
Misc cleanup:
- KNF
- WARNSfy
- remove __P()
- remove register declarations
- const'ify some variables
- make some local functions/variables static
- bcopy -> memcpy
- bcmp -> memcmp
- bzero -> memset
- space/TAB fix
etc.
 1.10 02-Oct-2003  simonb Use common m68k struct trapframe instead of rolling our own.
 1.9 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.8 02-Jan-2001  simonb branches: 1.8.24;
Convert both bootblocks and mkboot to use libsa's loadfile(), and make
both ELF aware.
 1.7 14-Dec-1999  thorpej Recode the kernel transfer point entirely in assembly to completely
avoid compiler surprises.
 1.6 14-Dec-1999  thorpej Make sure the compiler doens't reuse the registers we use to convey
information to the kernel.
 1.5 31-Jul-1999  thorpej branches: 1.5.2; 1.5.8;
Add 385 and 425e SPU detection. From OpenBSD.
 1.4 28-Jun-1997  thorpej branches: 1.4.18;
Adjust start address here, now that exec() no longer does it for us.
 1.3 12-May-1997  thorpej - Always build the romputchar() glue.
- Don't set "userom" in the trap handler (we didn't before, but we've
removed the previous CPP conditional that was used to enable it.)
 1.2 27-Apr-1997  thorpej Update getmachineid() for new machineid values.
 1.1 04-Feb-1997  thorpej Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.4.18.1 02-Aug-1999  thorpej Update from trunk.
 1.5.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.5.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.5.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.8.24.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.8.24.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.8.24.2 18-Sep-2004  skrll Sync with HEAD.
 1.8.24.1 03-Aug-2004  skrll Sync with HEAD
 1.11.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.11.8.1 29-Apr-2005  kent sync with -current
 1.12.4.1 30-Dec-2006  yamt sync with head.
 1.13.8.1 11-Aug-2006  yamt sync with head
 1.13.4.1 09-Sep-2006  rpaulo sync with head
 1.14.92.1 17-Feb-2011  bouyer Sync with HEAD
 1.14.90.1 06-Jun-2011  jruoho Sync with HEAD.
 1.14.84.1 05-Mar-2011  rmind sync with head
 1.15.86.1 22-Jun-2024  martin Pull up following revision(s) (requested by tsutsui in ticket #722):

sys/fs/cd9660/cd9660_util.c: revision 1.16
sys/arch/hp300/stand/common/clock.c: revision 1.14
sys/arch/hp300/stand/common/scsireg.h: revision 1.5
sys/arch/hp300/stand/common/scsireg.h: revision 1.6
sys/arch/hp300/stand/Makefile.buildboot: revision 1.38
sys/arch/hp300/include/bus.h: revision 1.23
sys/arch/hp300/stand/Makefile.buildboot: revision 1.39
sys/arch/hp300/stand/common/sd.c: revision 1.12
sys/arch/hp300/stand/common/prf.c: revision 1.6
sys/arch/hp300/stand/common/sd.c: revision 1.13
usr.sbin/installboot/installboot.8: revision 1.106
usr.sbin/installboot/Makefile: revision 1.59
sys/arch/hp300/stand/common/devopen.c: revision 1.14
usr.sbin/installboot/installboot.8: revision 1.107
sys/arch/hp300/stand/common/ite_dumb.c: revision 1.2
sys/arch/hp300/stand/common/devopen.c: revision 1.15
usr.sbin/installboot/installboot.8: revision 1.108
sys/fs/cd9660/cd9660_extern.h: revision 1.29
usr.sbin/installboot/installboot.8: revision 1.109
tools/Makefile.nbincludes: revision 1.11 (patch)
sys/arch/hp300/dev/rboxreg.h: revision 1.3
sys/arch/hp300/stand/common/scsivar.h: revision 1.5
sys/arch/hp300/dev/dnkbd.c: revision 1.14
sys/arch/hp300/hp300/trap.c: revision 1.156
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.12
sys/arch/hp300/dev/frodoreg.h: revision 1.6
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.13
sys/arch/hp300/stand/common/ite_sti.c: revision 1.2
sys/arch/hp300/stand/common/hil.c: revision 1.15
usr.sbin/installboot/arch/hp300.c: revision 1.18
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.14
sys/arch/hp300/dev/rbox.c: revision 1.4
usr.sbin/installboot/arch/hp300.c: revision 1.19
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.15
sys/sys/bootblock.h: revision 1.59
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.16
usr.sbin/installboot/installboot.h: revision 1.44
sys/arch/hp300/stand/mkboot/volhdr.h: file removal
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.17
sys/arch/hp300/dev/hpib.c: revision 1.45
usr.sbin/installboot/installboot.h: revision 1.45
usr.sbin/installboot/cd9660.c: revision 1.1
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.18
sys/arch/hp300/dev/topcatreg.h: revision 1.3
usr.sbin/installboot/cd9660.c: revision 1.2
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.19
sys/arch/hp300/stand/inst/inst.c: revision 1.25
sys/arch/hp300/stand/uboot/Makefile: revision 1.12
sys/arch/hp300/dev/dvbox.c: revision 1.4
sys/arch/hp300/dev/dma.c: revision 1.45
sys/arch/hp300/stand/uboot/Makefile: revision 1.13
sys/arch/hp300/stand/common/rd.c: revision 1.16
sys/arch/hp300/stand/inst/Makefile: revision 1.12
distrib/hp300/cdroms/installcd/Makefile: revision 1.4
sys/arch/hp300/stand/mkboot/volhdr.h: revision 1.6
sys/arch/hp300/stand/common/machdep.c: revision 1.16
usr.sbin/installboot/fstypes.c: revision 1.14
sys/arch/hp300/hp300/machdep.c: revision 1.238
sys/arch/hp300/include/cpu.h: revision 1.73
sys/arch/hp300/dev/diofbreg.h: revision 1.4
sys/arch/hp300/stand/common/scsi.c: revision 1.12
sys/arch/hp300/stand/common/netio.c: revision 1.19
sys/arch/hp300/stand/common/scsi.c: revision 1.13
sys/arch/hp300/dev/sti_sgc.c: revision 1.8
sys/arch/hp300/dev/rtc.c: revision 1.22
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.20
sys/arch/hp300/stand/common/conf.h: revision 1.4
sys/arch/hp300/hp300/autoconf.c: revision 1.111
sys/arch/hp300/stand/common/conf.c: revision 1.15
sys/arch/hp300/stand/mkboot/Makefile: revision 1.12
sys/arch/hp300/stand/mkboot/Makefile: revision 1.13
sys/arch/hp300/hp300/autoconf.c: revision 1.114
sys/arch/hp300/dev/dcmreg.h: revision 1.11
sys/arch/hp300/dev/diofbvar.h: revision 1.4
sys/arch/hp300/dev/dcm.c: revision 1.91
sys/fs/cd9660/cd9660_util.c: revision 1.15
sys/arch/hp300/dev/mcclock_frodo.c: revision 1.2

TAB/space cleanup.

installboot(8): formatting improvements

Use Ar foo instead of <foo>; this is mdoc.

Other formatting tweaks.
installboot(8): fix up markup

Don't overuse .Sy - when everything is highlighted, nothing is. Use
.Ic for options &c to get correct PostScript output (both are bold in
plain text).

Use Aq Ar inside .Pa, as both Pa and Ar are rendered as underscored
text in plain text output, and the distinction is lost.

Don't set examples in bold, but give them .Pp space around - they are
much easier to read this way.

Use consistent -width in FILES.
document how to use installboot on netbsd/vax.

PR/57909: Jan-Benedict Glaw: Don't include (build) timestamp when doing a
reproducible build
fix usage string, improve error handling.
add missing chunk for repro-build. fix gcc warnings.
avoid stringop truncation, fix copyright string to prevent assembler warnings.

Fix build as a tool (Jan-Benedict Glaw)

Fix integer overflow of strtol(3) for "loadpoint" address on ILP32 hosts.

This strtol(3) was introduced in rev 1.12 for PR/57909 after netbsd-10,
but it returns LONG_MAX (0x7FFFFFFF) for 0xFFF00000 on ILP32 hosts and
the wrong loadpoint causes "NOT ENOUGH MEMORY" error by the BOOTROMs
on loading uboot.lif on (at least) my 9000/360 and 9000/425t.

Misc cosmetic changes for mostly readability.
- KNF and add some newlines per blocks
- define and use proper bintobcd() macro
- make local functions and variables static

The same uboot.lif binaries are generated.

Rename ${PROGAOUT} -> ${PROGELF} to reflect reality.
Use proper signedness for the LIF file system data structures.

Ancient 4.3BSD used short and int for location, file size, file type,
and addresses etc. but all of them should be unsigned.

Also rename several variables and add comments for readability.
The LIF file system info can be found in "The HPDir Project" page:
https://www.hp9845.net/9845/projects/hpdir/
The same uboot.lif binaries are generated.

Add a preliminary CD boot support to uboot for preparation of PR/54455.
Briefly tested on mame, but not enalbed yet.

Recognize SCSI CD-ROM devices as a booted device properly.

Necessary for PR port-hp300/54455, to boot an md root root RAMDISK

kernel from CD-ROM without "WARNING: can't find match for bootdev:"
prompt.

Sync with src/sys/arch/hp300/stand/mkboot/volhdr.h rev 1.6.
https://mail-index.netbsd.org/source-changes/2024/05/07/msg151195.html

Use proper signedness for the LIF file system data structures.
mkboot should use this MI <sys/bootblock.h> and volhdr.h should
be removed soon.

Use MI <sys/bootblock.h> to refer LIF filesystem structures.
This should have been done when LIF definitions were initially added
to <sys/bootblock.h> for MI installboot(8).

Enable SUPPORT_CD on uboot.

Make cd9660_util.c usable in userland tools like installboot(8).

This was partially done for src/distrib/cdrom/macppc_installboot,
but more strict prototypes are necessary for native binary builds.

Install cd9660 related system headers for tools installboot(8) builds.

Reorder function prototypes per source files.

Add cd9660 support to search a bootloader file in the target file system.

Also add CD boot support for hp300, using a bootloader file in cd9660 fs.
This is a tool's part to close PR/54455.

HP 9000/300 machines read LIF directory entry allocated after
the LIF volume header at the top of the boot disk during bootstrap,
and a bootstrap file must be contiguously allocated on the disk
due to limitation of the LIF specification.

Current NetBSD/hp300's bootloader is larger than ~80KB so we have
to prepare a special 'boot' partition for FFS (that has only 8KB (ffsv1)
or 32KB (ffsv2) spaces) disks to put such a large bootloader.

On the other hand, on ISO9660 fs all files are allocated contiguously
so we can specify a bootloader file in the target ISO9660 directly
in the LIF directory entry.

Note we can simply use the existing "append" option to create bootable
CD ISO for hp300, but it looks some emulators (at leaset MAME) reject
such non-standard ISO files, i.e. with an appended bootloader file at
the end of the image.

Put a RAMDISK kernel and SYS_UBOOT into hp300 installcd to make it bootable.

This should finally close PR/54455.

Fix tools build errors on Cygwin.

Appease warnings on building tools/installboot on Cygwin.
 1.2 31-May-2025  tsutsui More cleanup and cosmetics in bootloader 1bpp ite sources.

- use C99 exact width integer types where appropriate
- make local variables static and read only variables const
- misc KNF

No visible regression on HP9000/380 with 1bpp DIO-II Hyperion.
 1.1 07-Feb-2011  tsutsui branches: 1.1.2; 1.1.4; 1.1.8; 1.1.98;
Resurrect and move retired ITE files that are still used by bootloaders.
 1.1.98.1 02-Aug-2025  perseant Sync with HEAD
 1.1.8.2 06-Jun-2011  jruoho Sync with HEAD.
 1.1.8.1 07-Feb-2011  jruoho file maskbits.h was added on branch jruoho-x86intr on 2011-06-06 09:05:39 +0000
 1.1.4.2 05-Mar-2011  rmind sync with head
 1.1.4.1 07-Feb-2011  rmind file maskbits.h was added on branch rmind-uvmplock on 2011-03-05 20:50:25 +0000
 1.1.2.2 08-Feb-2011  bouyer Sync with HEAD
 1.1.2.1 07-Feb-2011  bouyer file maskbits.h was added on branch bouyer-quota2 on 2011-02-08 16:19:23 +0000
 1.19 15-Jan-2023  tsutsui TAB/space cleanup.
 1.18 12-Apr-2021  mrg branches: 1.18.16;
remove shadowed (common) declarations of various libsa variables
from various boot programs. for macppc and zaurus, avoid building
with -fcommon any more.
 1.17 28-Apr-2020  tsutsui branches: 1.17.4;
Fix inappropriate error messages when nfs_mount() fails.

Noticed by Chris Hanson and his HP330 and confirmed on my HP425e.
Also bump revisions to denote visible changes.
Worth to pull up to netbsd-9.
 1.16 11-Jun-2016  dholland branches: 1.16.22;
gets_s -> kgets.

The exact name isn't that important; but it is important not to use
"gets_s" and thereby allow anyone to falsely get the impression we're
implementing Annex K. We aren't.

ok core.
 1.15 05-Jun-2016  christos get rid of gets/tgets
 1.14 17-Jul-2011  joerg branches: 1.14.12; 1.14.30;
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.13 21-Oct-2009  snj Drop 3rd and 4th clauses. Approved by gwr@ (copyright holder).
 1.12 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.11 11-Dec-2005  christos branches: 1.11.74; 1.11.76; 1.11.78;
merge ktrace-lwp.
 1.10 20-Feb-2005  tsutsui Use ANSI function decls.
 1.9 14-Nov-2003  tsutsui branches: 1.9.8; 1.9.10;
Misc cleanup:
- KNF
- WARNSfy
- remove __P()
- remove register declarations
- const'ify some variables
- make some local functions/variables static
- bcopy -> memcpy
- bcmp -> memcmp
- bzero -> memset
- space/TAB fix
etc.
 1.8 03-Dec-2001  gmcgarry branches: 1.8.16;
Use BOOTP by default.
 1.7 13-Nov-1999  thorpej branches: 1.7.8; 1.7.12;
Backout my libsa changes.
 1.6 11-Nov-1999  thorpej Don't reference libkern.h.
 1.5 07-May-1999  drochner branches: 1.5.2; 1.5.4; 1.5.8;
include <lib/libkern/libkern.h> for intoa()/inet_ntoa()
 1.4 04-Oct-1997  thorpej branches: 1.4.12;
Copyright assigned to The NetBSD Foundation.
 1.3 22-Jul-1997  drochner branches: 1.3.2;
Don't use <lib/libsa/if_ether.h> anymore. This was a copy of the
old (before ARP changes) <netinet/if_ether.h>, intended for
temporary use.
 1.2 15-Mar-1997  is New ARP system, supports IPv4 over any hardware link.

Some of the stuff (e.g., rarpd, bootpd, dhcpd etc., libsa) still will
only support Ethernet. Tcpdump itself should be ok, but libpcap needs
lot of work.

For the detailed change history, look at the commit log entries for
the is-newarp branch.
 1.1 04-Feb-1997  thorpej branches: 1.1.4;
Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.1.4.1 07-Mar-1997  is Use libsa copy of oldstyle if_ether.h for now
 1.3.2.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.4.12.1 21-Jun-1999  thorpej Sync w/ -current.
 1.5.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.5.4.1 15-Nov-1999  fvdl Sync with -current
 1.5.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.7.12.1 08-Jan-2002  nathanw Catch up to -current.
 1.7.8.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.8.16.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.8.16.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.8.16.2 18-Sep-2004  skrll Sync with HEAD.
 1.8.16.1 03-Aug-2004  skrll Sync with HEAD
 1.9.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.9.8.1 29-Apr-2005  kent sync with -current
 1.11.78.2 11-Mar-2010  yamt sync with head
 1.11.78.1 16-May-2008  yamt sync with head.
 1.11.76.1 18-May-2008  yamt sync with head.
 1.11.74.1 02-Jun-2008  mjf Sync with HEAD.
 1.14.30.1 09-Jul-2016  skrll Sync with HEAD
 1.14.12.1 03-Dec-2017  jdolecek update from HEAD
 1.16.22.1 01-May-2020  martin Pull up following revision(s) (requested by tsutsui in ticket #880):

sys/arch/hp300/stand/uboot/version: revision 1.21
sys/arch/hp300/stand/inst/version: revision 1.14
sys/arch/hp300/stand/common/netio.c: revision 1.17

Fix inappropriate error messages when nfs_mount() fails.

Noticed by Chris Hanson and his HP332 and confirmed on my HP425e.

Also bump revisions to denote visible changes.
Worth to pull up to netbsd-9.
 1.17.4.1 17-Apr-2021  thorpej Sync with HEAD.
 1.18.16.1 22-Jun-2024  martin Pull up following revision(s) (requested by tsutsui in ticket #722):

sys/fs/cd9660/cd9660_util.c: revision 1.16
sys/arch/hp300/stand/common/clock.c: revision 1.14
sys/arch/hp300/stand/common/scsireg.h: revision 1.5
sys/arch/hp300/stand/common/scsireg.h: revision 1.6
sys/arch/hp300/stand/Makefile.buildboot: revision 1.38
sys/arch/hp300/include/bus.h: revision 1.23
sys/arch/hp300/stand/Makefile.buildboot: revision 1.39
sys/arch/hp300/stand/common/sd.c: revision 1.12
sys/arch/hp300/stand/common/prf.c: revision 1.6
sys/arch/hp300/stand/common/sd.c: revision 1.13
usr.sbin/installboot/installboot.8: revision 1.106
usr.sbin/installboot/Makefile: revision 1.59
sys/arch/hp300/stand/common/devopen.c: revision 1.14
usr.sbin/installboot/installboot.8: revision 1.107
sys/arch/hp300/stand/common/ite_dumb.c: revision 1.2
sys/arch/hp300/stand/common/devopen.c: revision 1.15
usr.sbin/installboot/installboot.8: revision 1.108
sys/fs/cd9660/cd9660_extern.h: revision 1.29
usr.sbin/installboot/installboot.8: revision 1.109
tools/Makefile.nbincludes: revision 1.11 (patch)
sys/arch/hp300/dev/rboxreg.h: revision 1.3
sys/arch/hp300/stand/common/scsivar.h: revision 1.5
sys/arch/hp300/dev/dnkbd.c: revision 1.14
sys/arch/hp300/hp300/trap.c: revision 1.156
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.12
sys/arch/hp300/dev/frodoreg.h: revision 1.6
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.13
sys/arch/hp300/stand/common/ite_sti.c: revision 1.2
sys/arch/hp300/stand/common/hil.c: revision 1.15
usr.sbin/installboot/arch/hp300.c: revision 1.18
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.14
sys/arch/hp300/dev/rbox.c: revision 1.4
usr.sbin/installboot/arch/hp300.c: revision 1.19
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.15
sys/sys/bootblock.h: revision 1.59
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.16
usr.sbin/installboot/installboot.h: revision 1.44
sys/arch/hp300/stand/mkboot/volhdr.h: file removal
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.17
sys/arch/hp300/dev/hpib.c: revision 1.45
usr.sbin/installboot/installboot.h: revision 1.45
usr.sbin/installboot/cd9660.c: revision 1.1
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.18
sys/arch/hp300/dev/topcatreg.h: revision 1.3
usr.sbin/installboot/cd9660.c: revision 1.2
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.19
sys/arch/hp300/stand/inst/inst.c: revision 1.25
sys/arch/hp300/stand/uboot/Makefile: revision 1.12
sys/arch/hp300/dev/dvbox.c: revision 1.4
sys/arch/hp300/dev/dma.c: revision 1.45
sys/arch/hp300/stand/uboot/Makefile: revision 1.13
sys/arch/hp300/stand/common/rd.c: revision 1.16
sys/arch/hp300/stand/inst/Makefile: revision 1.12
distrib/hp300/cdroms/installcd/Makefile: revision 1.4
sys/arch/hp300/stand/mkboot/volhdr.h: revision 1.6
sys/arch/hp300/stand/common/machdep.c: revision 1.16
usr.sbin/installboot/fstypes.c: revision 1.14
sys/arch/hp300/hp300/machdep.c: revision 1.238
sys/arch/hp300/include/cpu.h: revision 1.73
sys/arch/hp300/dev/diofbreg.h: revision 1.4
sys/arch/hp300/stand/common/scsi.c: revision 1.12
sys/arch/hp300/stand/common/netio.c: revision 1.19
sys/arch/hp300/stand/common/scsi.c: revision 1.13
sys/arch/hp300/dev/sti_sgc.c: revision 1.8
sys/arch/hp300/dev/rtc.c: revision 1.22
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.20
sys/arch/hp300/stand/common/conf.h: revision 1.4
sys/arch/hp300/hp300/autoconf.c: revision 1.111
sys/arch/hp300/stand/common/conf.c: revision 1.15
sys/arch/hp300/stand/mkboot/Makefile: revision 1.12
sys/arch/hp300/stand/mkboot/Makefile: revision 1.13
sys/arch/hp300/hp300/autoconf.c: revision 1.114
sys/arch/hp300/dev/dcmreg.h: revision 1.11
sys/arch/hp300/dev/diofbvar.h: revision 1.4
sys/arch/hp300/dev/dcm.c: revision 1.91
sys/fs/cd9660/cd9660_util.c: revision 1.15
sys/arch/hp300/dev/mcclock_frodo.c: revision 1.2

TAB/space cleanup.

installboot(8): formatting improvements

Use Ar foo instead of <foo>; this is mdoc.

Other formatting tweaks.
installboot(8): fix up markup

Don't overuse .Sy - when everything is highlighted, nothing is. Use
.Ic for options &c to get correct PostScript output (both are bold in
plain text).

Use Aq Ar inside .Pa, as both Pa and Ar are rendered as underscored
text in plain text output, and the distinction is lost.

Don't set examples in bold, but give them .Pp space around - they are
much easier to read this way.

Use consistent -width in FILES.
document how to use installboot on netbsd/vax.

PR/57909: Jan-Benedict Glaw: Don't include (build) timestamp when doing a
reproducible build
fix usage string, improve error handling.
add missing chunk for repro-build. fix gcc warnings.
avoid stringop truncation, fix copyright string to prevent assembler warnings.

Fix build as a tool (Jan-Benedict Glaw)

Fix integer overflow of strtol(3) for "loadpoint" address on ILP32 hosts.

This strtol(3) was introduced in rev 1.12 for PR/57909 after netbsd-10,
but it returns LONG_MAX (0x7FFFFFFF) for 0xFFF00000 on ILP32 hosts and
the wrong loadpoint causes "NOT ENOUGH MEMORY" error by the BOOTROMs
on loading uboot.lif on (at least) my 9000/360 and 9000/425t.

Misc cosmetic changes for mostly readability.
- KNF and add some newlines per blocks
- define and use proper bintobcd() macro
- make local functions and variables static

The same uboot.lif binaries are generated.

Rename ${PROGAOUT} -> ${PROGELF} to reflect reality.
Use proper signedness for the LIF file system data structures.

Ancient 4.3BSD used short and int for location, file size, file type,
and addresses etc. but all of them should be unsigned.

Also rename several variables and add comments for readability.
The LIF file system info can be found in "The HPDir Project" page:
https://www.hp9845.net/9845/projects/hpdir/
The same uboot.lif binaries are generated.

Add a preliminary CD boot support to uboot for preparation of PR/54455.
Briefly tested on mame, but not enalbed yet.

Recognize SCSI CD-ROM devices as a booted device properly.

Necessary for PR port-hp300/54455, to boot an md root root RAMDISK

kernel from CD-ROM without "WARNING: can't find match for bootdev:"
prompt.

Sync with src/sys/arch/hp300/stand/mkboot/volhdr.h rev 1.6.
https://mail-index.netbsd.org/source-changes/2024/05/07/msg151195.html

Use proper signedness for the LIF file system data structures.
mkboot should use this MI <sys/bootblock.h> and volhdr.h should
be removed soon.

Use MI <sys/bootblock.h> to refer LIF filesystem structures.
This should have been done when LIF definitions were initially added
to <sys/bootblock.h> for MI installboot(8).

Enable SUPPORT_CD on uboot.

Make cd9660_util.c usable in userland tools like installboot(8).

This was partially done for src/distrib/cdrom/macppc_installboot,
but more strict prototypes are necessary for native binary builds.

Install cd9660 related system headers for tools installboot(8) builds.

Reorder function prototypes per source files.

Add cd9660 support to search a bootloader file in the target file system.

Also add CD boot support for hp300, using a bootloader file in cd9660 fs.
This is a tool's part to close PR/54455.

HP 9000/300 machines read LIF directory entry allocated after
the LIF volume header at the top of the boot disk during bootstrap,
and a bootstrap file must be contiguously allocated on the disk
due to limitation of the LIF specification.

Current NetBSD/hp300's bootloader is larger than ~80KB so we have
to prepare a special 'boot' partition for FFS (that has only 8KB (ffsv1)
or 32KB (ffsv2) spaces) disks to put such a large bootloader.

On the other hand, on ISO9660 fs all files are allocated contiguously
so we can specify a bootloader file in the target ISO9660 directly
in the LIF directory entry.

Note we can simply use the existing "append" option to create bootable
CD ISO for hp300, but it looks some emulators (at leaset MAME) reject
such non-standard ISO files, i.e. with an appended bootloader file at
the end of the image.

Put a RAMDISK kernel and SYS_UBOOT into hp300 installcd to make it bootable.

This should finally close PR/54455.

Fix tools build errors on Cygwin.

Appease warnings on building tools/installboot on Cygwin.
 1.2 16-Dec-2000  simonb Use sys/conf/newvers_stand.sh instead of local script.
 1.1 04-Feb-1997  thorpej branches: 1.1.26;
Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.1.26.1 05-Jan-2001  bouyer Sync with HEAD
 1.6 25-Jun-2006  tsutsui Use (uint8_t *) to specify buffers for hpib xfers.
 1.5 11-Dec-2005  christos branches: 1.5.4; 1.5.8; 1.5.16;
merge ktrace-lwp.
 1.4 20-Feb-2005  tsutsui branches: 1.4.4;
Use ANSI function decls.
 1.3 14-Nov-2003  tsutsui branches: 1.3.8; 1.3.10;
Misc cleanup:
- KNF
- WARNSfy
- remove __P()
- remove register declarations
- const'ify some variables
- make some local functions/variables static
- bcopy -> memcpy
- bcmp -> memcmp
- bzero -> memset
- space/TAB fix
etc.
 1.2 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.1 04-Feb-1997  thorpej branches: 1.1.60;
Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.1.60.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.1.60.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.60.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.60.1 03-Aug-2004  skrll Sync with HEAD
 1.3.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.3.8.1 29-Apr-2005  kent sync with -current
 1.4.4.1 30-Dec-2006  yamt sync with head.
 1.5.16.1 13-Jul-2006  gdamore Merge from HEAD.
 1.5.8.1 26-Jun-2006  yamt sync with head.
 1.5.4.1 09-Sep-2006  rpaulo sync with head
 1.6 15-Jan-2023  tsutsui TAB/space cleanup.
 1.5 11-Dec-2005  christos branches: 1.5.196;
merge ktrace-lwp.
 1.4 20-Feb-2005  tsutsui Use ANSI function decls.
 1.3 14-Nov-2003  tsutsui branches: 1.3.8; 1.3.10;
Misc cleanup:
- KNF
- WARNSfy
- remove __P()
- remove register declarations
- const'ify some variables
- make some local functions/variables static
- bcopy -> memcpy
- bcmp -> memcmp
- bzero -> memset
- space/TAB fix
etc.
 1.2 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.1 04-Feb-1997  thorpej branches: 1.1.60;
Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.1.60.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.1.60.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.60.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.60.1 03-Aug-2004  skrll Sync with HEAD
 1.3.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.3.8.1 29-Apr-2005  kent sync with -current
 1.5.196.1 22-Jun-2024  martin Pull up following revision(s) (requested by tsutsui in ticket #722):

sys/fs/cd9660/cd9660_util.c: revision 1.16
sys/arch/hp300/stand/common/clock.c: revision 1.14
sys/arch/hp300/stand/common/scsireg.h: revision 1.5
sys/arch/hp300/stand/common/scsireg.h: revision 1.6
sys/arch/hp300/stand/Makefile.buildboot: revision 1.38
sys/arch/hp300/include/bus.h: revision 1.23
sys/arch/hp300/stand/Makefile.buildboot: revision 1.39
sys/arch/hp300/stand/common/sd.c: revision 1.12
sys/arch/hp300/stand/common/prf.c: revision 1.6
sys/arch/hp300/stand/common/sd.c: revision 1.13
usr.sbin/installboot/installboot.8: revision 1.106
usr.sbin/installboot/Makefile: revision 1.59
sys/arch/hp300/stand/common/devopen.c: revision 1.14
usr.sbin/installboot/installboot.8: revision 1.107
sys/arch/hp300/stand/common/ite_dumb.c: revision 1.2
sys/arch/hp300/stand/common/devopen.c: revision 1.15
usr.sbin/installboot/installboot.8: revision 1.108
sys/fs/cd9660/cd9660_extern.h: revision 1.29
usr.sbin/installboot/installboot.8: revision 1.109
tools/Makefile.nbincludes: revision 1.11 (patch)
sys/arch/hp300/dev/rboxreg.h: revision 1.3
sys/arch/hp300/stand/common/scsivar.h: revision 1.5
sys/arch/hp300/dev/dnkbd.c: revision 1.14
sys/arch/hp300/hp300/trap.c: revision 1.156
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.12
sys/arch/hp300/dev/frodoreg.h: revision 1.6
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.13
sys/arch/hp300/stand/common/ite_sti.c: revision 1.2
sys/arch/hp300/stand/common/hil.c: revision 1.15
usr.sbin/installboot/arch/hp300.c: revision 1.18
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.14
sys/arch/hp300/dev/rbox.c: revision 1.4
usr.sbin/installboot/arch/hp300.c: revision 1.19
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.15
sys/sys/bootblock.h: revision 1.59
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.16
usr.sbin/installboot/installboot.h: revision 1.44
sys/arch/hp300/stand/mkboot/volhdr.h: file removal
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.17
sys/arch/hp300/dev/hpib.c: revision 1.45
usr.sbin/installboot/installboot.h: revision 1.45
usr.sbin/installboot/cd9660.c: revision 1.1
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.18
sys/arch/hp300/dev/topcatreg.h: revision 1.3
usr.sbin/installboot/cd9660.c: revision 1.2
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.19
sys/arch/hp300/stand/inst/inst.c: revision 1.25
sys/arch/hp300/stand/uboot/Makefile: revision 1.12
sys/arch/hp300/dev/dvbox.c: revision 1.4
sys/arch/hp300/dev/dma.c: revision 1.45
sys/arch/hp300/stand/uboot/Makefile: revision 1.13
sys/arch/hp300/stand/common/rd.c: revision 1.16
sys/arch/hp300/stand/inst/Makefile: revision 1.12
distrib/hp300/cdroms/installcd/Makefile: revision 1.4
sys/arch/hp300/stand/mkboot/volhdr.h: revision 1.6
sys/arch/hp300/stand/common/machdep.c: revision 1.16
usr.sbin/installboot/fstypes.c: revision 1.14
sys/arch/hp300/hp300/machdep.c: revision 1.238
sys/arch/hp300/include/cpu.h: revision 1.73
sys/arch/hp300/dev/diofbreg.h: revision 1.4
sys/arch/hp300/stand/common/scsi.c: revision 1.12
sys/arch/hp300/stand/common/netio.c: revision 1.19
sys/arch/hp300/stand/common/scsi.c: revision 1.13
sys/arch/hp300/dev/sti_sgc.c: revision 1.8
sys/arch/hp300/dev/rtc.c: revision 1.22
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.20
sys/arch/hp300/stand/common/conf.h: revision 1.4
sys/arch/hp300/hp300/autoconf.c: revision 1.111
sys/arch/hp300/stand/common/conf.c: revision 1.15
sys/arch/hp300/stand/mkboot/Makefile: revision 1.12
sys/arch/hp300/stand/mkboot/Makefile: revision 1.13
sys/arch/hp300/hp300/autoconf.c: revision 1.114
sys/arch/hp300/dev/dcmreg.h: revision 1.11
sys/arch/hp300/dev/diofbvar.h: revision 1.4
sys/arch/hp300/dev/dcm.c: revision 1.91
sys/fs/cd9660/cd9660_util.c: revision 1.15
sys/arch/hp300/dev/mcclock_frodo.c: revision 1.2

TAB/space cleanup.

installboot(8): formatting improvements

Use Ar foo instead of <foo>; this is mdoc.

Other formatting tweaks.
installboot(8): fix up markup

Don't overuse .Sy - when everything is highlighted, nothing is. Use
.Ic for options &c to get correct PostScript output (both are bold in
plain text).

Use Aq Ar inside .Pa, as both Pa and Ar are rendered as underscored
text in plain text output, and the distinction is lost.

Don't set examples in bold, but give them .Pp space around - they are
much easier to read this way.

Use consistent -width in FILES.
document how to use installboot on netbsd/vax.

PR/57909: Jan-Benedict Glaw: Don't include (build) timestamp when doing a
reproducible build
fix usage string, improve error handling.
add missing chunk for repro-build. fix gcc warnings.
avoid stringop truncation, fix copyright string to prevent assembler warnings.

Fix build as a tool (Jan-Benedict Glaw)

Fix integer overflow of strtol(3) for "loadpoint" address on ILP32 hosts.

This strtol(3) was introduced in rev 1.12 for PR/57909 after netbsd-10,
but it returns LONG_MAX (0x7FFFFFFF) for 0xFFF00000 on ILP32 hosts and
the wrong loadpoint causes "NOT ENOUGH MEMORY" error by the BOOTROMs
on loading uboot.lif on (at least) my 9000/360 and 9000/425t.

Misc cosmetic changes for mostly readability.
- KNF and add some newlines per blocks
- define and use proper bintobcd() macro
- make local functions and variables static

The same uboot.lif binaries are generated.

Rename ${PROGAOUT} -> ${PROGELF} to reflect reality.
Use proper signedness for the LIF file system data structures.

Ancient 4.3BSD used short and int for location, file size, file type,
and addresses etc. but all of them should be unsigned.

Also rename several variables and add comments for readability.
The LIF file system info can be found in "The HPDir Project" page:
https://www.hp9845.net/9845/projects/hpdir/
The same uboot.lif binaries are generated.

Add a preliminary CD boot support to uboot for preparation of PR/54455.
Briefly tested on mame, but not enalbed yet.

Recognize SCSI CD-ROM devices as a booted device properly.

Necessary for PR port-hp300/54455, to boot an md root root RAMDISK

kernel from CD-ROM without "WARNING: can't find match for bootdev:"
prompt.

Sync with src/sys/arch/hp300/stand/mkboot/volhdr.h rev 1.6.
https://mail-index.netbsd.org/source-changes/2024/05/07/msg151195.html

Use proper signedness for the LIF file system data structures.
mkboot should use this MI <sys/bootblock.h> and volhdr.h should
be removed soon.

Use MI <sys/bootblock.h> to refer LIF filesystem structures.
This should have been done when LIF definitions were initially added
to <sys/bootblock.h> for MI installboot(8).

Enable SUPPORT_CD on uboot.

Make cd9660_util.c usable in userland tools like installboot(8).

This was partially done for src/distrib/cdrom/macppc_installboot,
but more strict prototypes are necessary for native binary builds.

Install cd9660 related system headers for tools installboot(8) builds.

Reorder function prototypes per source files.

Add cd9660 support to search a bootloader file in the target file system.

Also add CD boot support for hp300, using a bootloader file in cd9660 fs.
This is a tool's part to close PR/54455.

HP 9000/300 machines read LIF directory entry allocated after
the LIF volume header at the top of the boot disk during bootstrap,
and a bootstrap file must be contiguously allocated on the disk
due to limitation of the LIF specification.

Current NetBSD/hp300's bootloader is larger than ~80KB so we have
to prepare a special 'boot' partition for FFS (that has only 8KB (ffsv1)
or 32KB (ffsv2) spaces) disks to put such a large bootloader.

On the other hand, on ISO9660 fs all files are allocated contiguously
so we can specify a bootloader file in the target ISO9660 directly
in the LIF directory entry.

Note we can simply use the existing "append" option to create bootable
CD ISO for hp300, but it looks some emulators (at leaset MAME) reject
such non-standard ISO files, i.e. with an appended bootloader file at
the end of the image.

Put a RAMDISK kernel and SYS_UBOOT into hp300 installcd to make it bootable.

This should finally close PR/54455.

Fix tools build errors on Cygwin.

Appease warnings on building tools/installboot on Cygwin.
 1.8 21-Oct-2009  snj Drop 3rd and 4th clauses. Approved by gwr@ (copyright holder).
 1.7 25-Jun-2006  tsutsui branches: 1.7.62;
Fix unsigned/signed mismatch.
 1.6 25-Jan-2006  christos branches: 1.6.2; 1.6.6; 1.6.14;
free -> dealloc
unsigned -> size_t for alloc/dealloc
 1.5 11-Dec-2005  christos branches: 1.5.2;
merge ktrace-lwp.
 1.4 20-Feb-2005  tsutsui branches: 1.4.4;
Use ANSI function decls.
 1.3 14-Nov-2003  tsutsui branches: 1.3.8; 1.3.10;
Misc cleanup:
- KNF
- WARNSfy
- remove __P()
- remove register declarations
- const'ify some variables
- make some local functions/variables static
- bcopy -> memcpy
- bcmp -> memcmp
- bzero -> memset
- space/TAB fix
etc.
 1.2 21-Aug-2003  he Adapt to const-ification of first arg of open function in fs_ops.
 1.1 04-Feb-1997  thorpej branches: 1.1.60;
Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.1.60.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.1.60.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.60.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.60.1 03-Aug-2004  skrll Sync with HEAD
 1.3.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.3.8.1 29-Apr-2005  kent sync with -current
 1.4.4.2 30-Dec-2006  yamt sync with head.
 1.4.4.1 21-Jun-2006  yamt sync with head.
 1.5.2.1 01-Feb-2006  yamt sync with head.
 1.6.14.1 13-Jul-2006  gdamore Merge from HEAD.
 1.6.6.1 26-Jun-2006  yamt sync with head.
 1.6.2.1 09-Sep-2006  rpaulo sync with head
 1.7.62.1 11-Mar-2010  yamt sync with head
 1.4 11-Dec-2005  christos merge ktrace-lwp.
 1.3 14-Nov-2003  tsutsui Misc cleanup:
- KNF
- WARNSfy
- remove __P()
- remove register declarations
- const'ify some variables
- make some local functions/variables static
- bcopy -> memcpy
- bcmp -> memcmp
- bzero -> memset
- space/TAB fix
etc.
 1.2 21-Aug-2003  he Adapt to const-ification of first arg of open function in fs_ops.
 1.1 04-Feb-1997  thorpej branches: 1.1.60;
Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.1.60.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.60.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.60.1 03-Aug-2004  skrll Sync with HEAD
 1.17 12-Feb-2023  andvar fix various typos in comments.
 1.16 15-Jan-2023  tsutsui TAB/space cleanup.
 1.15 25-Nov-2022  tsutsui branches: 1.15.2;
Sync with rdreg.h integer type changes.
 1.14 21-Nov-2022  tsutsui Use common macro for numbers of cylinders and blocks for HP-IB disks.

No binary changes.
 1.13 21-Nov-2022  tsutsui Make local variables static and read only ones const.
 1.12 21-Nov-2022  tsutsui Sync a list of HP-IB disk IDs with kernel's one.

Now bootloader can boot from 2202A, 7908A, 7911A, and 7941A.
Tested on 425t and HPDisk.
 1.11 05-Jul-2021  tsutsui Cleanup duplicated CS/80 indentify structures. From OpenBSD.

https://marc.info/?l=openbsd-cvs&m=113227249626888&w=2
> Define the CS/80 identify structure only once and correctly, instead of
> duplicating it in every CS/80 driver and using an hardcoded number for
> its size.
> No functional change.

https://marc.info/?l=openbsd-cvs&m=113273001020159&w=2
> Pick HP-IB describe structures changes from main kernel code here as well.
 1.10 17-Jul-2011  joerg branches: 1.10.58; 1.10.70;
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.9 08-Feb-2011  rmind Remove clause 3 (UCB advertising clause) from the University of Utah
copyright. Confirmed by Mike Hibler, mike at cs.utah.edu - thanks!
Also, merge UCB and Utah copyright texts back into one, as they
originally were.

Extra verification by snj@.
 1.8 04-Mar-2007  christos branches: 1.8.66; 1.8.72; 1.8.74;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.7 25-Jun-2006  tsutsui branches: 1.7.10;
Use (uint8_t *) to specify buffers for hpib xfers.
 1.6 11-Dec-2005  christos branches: 1.6.4; 1.6.8; 1.6.16;
merge ktrace-lwp.
 1.5 20-Feb-2005  tsutsui branches: 1.5.4;
Use ANSI function decls.
 1.4 28-Aug-2004  thorpej branches: 1.4.4; 1.4.6;
Remove the last vestiges of COMPAT_NOLABEL. It's been 10 years; label
your disks already.
 1.3 14-Nov-2003  tsutsui Misc cleanup:
- KNF
- WARNSfy
- remove __P()
- remove register declarations
- const'ify some variables
- make some local functions/variables static
- bcopy -> memcpy
- bcmp -> memcmp
- bzero -> memset
- space/TAB fix
etc.
 1.2 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.1 04-Feb-1997  thorpej branches: 1.1.60;
Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.1.60.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.1.60.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.60.3 18-Sep-2004  skrll Sync with HEAD.
 1.1.60.2 03-Sep-2004  skrll Sync with HEAD
 1.1.60.1 03-Aug-2004  skrll Sync with HEAD
 1.4.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.4.4.1 29-Apr-2005  kent sync with -current
 1.5.4.2 03-Sep-2007  yamt sync with head.
 1.5.4.1 30-Dec-2006  yamt sync with head.
 1.6.16.1 13-Jul-2006  gdamore Merge from HEAD.
 1.6.8.1 26-Jun-2006  yamt sync with head.
 1.6.4.1 09-Sep-2006  rpaulo sync with head
 1.7.10.1 12-Mar-2007  rmind Sync with HEAD.
 1.8.74.1 17-Feb-2011  bouyer Sync with HEAD
 1.8.72.1 06-Jun-2011  jruoho Sync with HEAD.
 1.8.66.1 05-Mar-2011  rmind sync with head
 1.10.70.1 01-Aug-2021  thorpej Sync with HEAD.
 1.10.58.2 06-Dec-2022  martin Pull up following revision(s) (requested by tsutsui in ticket #1552):

sys/arch/hp300/dev/rd.c: revision 1.120
sys/arch/hp300/dev/rd.c: revision 1.121
sys/arch/hp300/dev/rd.c: revision 1.122
sys/arch/hp300/dev/rd.c: revision 1.123
sys/arch/hp300/dev/rd.c: revision 1.124
sys/arch/hp300/dev/rdreg.h: revision 1.19
sys/arch/hp300/dev/rd.c: revision 1.111
sys/arch/hp300/dev/rd.c: revision 1.112
sys/arch/hp300/dev/rd.c: revision 1.113
sys/arch/hp300/stand/common/rd.c: revision 1.12
sys/arch/hp300/dev/rd.c: revision 1.114
sys/arch/hp300/stand/common/rd.c: revision 1.13
sys/arch/hp300/dev/rd.c: revision 1.115
sys/arch/hp300/stand/common/rd.c: revision 1.14
sys/arch/hp300/dev/rd.c: revision 1.116
sys/arch/hp300/stand/common/rd.c: revision 1.15
sys/arch/hp300/dev/rd.c: revision 1.117
sys/arch/hp300/dev/rd.c: revision 1.118
sys/arch/hp300/dev/rd.c: revision 1.119
sys/arch/hp300/dev/rdvar.h: revision 1.27
sys/arch/hp300/dev/rdreg.h: revision 1.20

Sync a list of HP-IB disk IDs with kernel's one.
Now bootloader can boot from 2202A, 7908A, 7911A, and 7941A.
Tested on 425t and HPDisk.

Make local variables static and read only ones const.

Use common macro for numbers of cylinders and blocks for HP-IB disks.
No binary changes.

Fix "rd(4) at punits not configured on HPDisk are misprobed" problem.
- check not only stat value returned by C_QSTAT command against
each punit but also desc.d_name returned by C_DESC command
because it looks HPDisk responds to commands against punits supported
but not-configured punits at 1-3
- prepare rdreset_unit() function to manage reset punit ops during
probe without valid softc

The stragety is taken from OpenBSD with several modification.
Tested on 425t with real 9122D and HPDisk emulating two 7937H drives.
Should be pulled up to netbsd-9.

Remove now unused buffer members from softc prepared only for rdreset().

Use proper integer types for HP-IB xfer parameters.
No visible regression on 425t and HPDisk.

Sync with rdreg.h integer type changes.

Remove unnecessary declarations.

Check bounds of RAW_PART by bounds_check_with_mediasize() as other drivers.
With this check, dd(1) without a count value against a raw partition
is terminated properly at the end of media. Tested on 425t and HPDisk.
Should be pulled up to netbsd-9.

Check bounds of each partition by MI bounds_check_with_label(9).
The previous implementation was committed in rev 1.26 about 26 years ago
and it looks there is no quirk to use the old MD one.

Pass a correct dev_t arg to disk_ioctl().
Probably harmless.

Remove a duplicated static function declaration.

Set disk_geom parameters required by DIOCGPARTINFO in disk_ioctl().
With this change raid(4) no longer complains before mountroot:
RAIDframe: can't get disk size for dev rd0 (22)
Should be pulled up to netbsd-9.

Use proper RAW_PART macro rather than a magic number.

Remove more duplicated static function declarations.

Misc KNF and cosmetics.

Add empty DIOCCACHESYNC ioctl(2) for rd(4).
Without this raid(4) always complains on various raidctl(8) ops:
raid0: cache flush[0] to component 0 failed (22)
RAID1 configured by raid(4) just works HP-IB disks on hp300.

Explicitly include <sys/kernel.h> for hz(9) as man pages says.
XXX: it looks sys/param.h r1.615 and later also has extern int hz
 1.10.58.1 14-Jul-2021  martin Pull up following revision(s) (requested by tsutsui in ticket #1323):

sys/arch/hp300/dev/rd.c: revision 1.109
sys/arch/hp300/stand/Makefile.buildboot: revision 1.37
sys/arch/hp300/stand/common/ct.c: revision 1.8
sys/arch/hp300/dev/hpibvar.h: revision 1.22
sys/arch/hp300/dev/ct.c: revision 1.62
sys/arch/hp300/dev/hpibvar.h: revision 1.23
sys/arch/hp300/dev/ct.c: revision 1.63
sys/arch/hp300/dev/hpibvar.h: revision 1.24
sys/arch/hp300/dev/mt.c: revision 1.55
sys/arch/hp300/dev/rdreg.h: revision 1.14
sys/arch/hp300/dev/hpib.c: revision 1.43 (via patch)
sys/arch/hp300/dev/rdreg.h: revision 1.15
sys/arch/hp300/dev/rdreg.h: revision 1.16
sys/arch/hp300/dev/rdreg.h: revision 1.17
etc/etc.hp300/MAKEDEV.conf: revision 1.15
sys/arch/hp300/stand/common/hpibvar.h: revision 1.6
sys/arch/hp300/stand/common/rd.c: revision 1.11
sys/arch/hp300/dev/ctreg.h: revision 1.11
sys/arch/hp300/dev/rdvar.h: revision 1.24
sys/arch/hp300/dev/rdvar.h: revision 1.25
sys/arch/hp300/dev/rdvar.h: revision 1.26
sys/arch/hp300/dev/rd.c: revision 1.103
sys/arch/hp300/dev/rd.c: revision 1.104
sys/arch/hp300/dev/rd.c: revision 1.105
sys/arch/hp300/dev/rd.c: revision 1.106
sys/arch/hp300/dev/rd.c: revision 1.107
sys/arch/hp300/dev/rd.c: revision 1.108

Consistently use #define<tab> here.

Consistently use #define<tab> as rdreg.h.

No need to bother to use aprint_debug(9) inside #ifdef DEBUG block.

Pull HP-IB probe fixes from OpenBSD/hp300.
https://marc.info/?l=openbsd-cvs&m=113217630426615&w=2

Overhaul the way HP-IB devices are probed. We will now do an exhaustive
probe of the (slave, punit) tuple space, since this is the only way we
can get a dual disk or dual tape enclosure to attach two devices of the
same kind.

This allows using multiple rd(4) disk images on the same slave emulated
by HPDisk (and probably the real 9122D with dual floppy disk drives).

Thanks to Miod Vallat for suggesting this fix.

Move attach messages from common rdident() to explicit rdattach().

Cleanup duplicated CS/80 indentify structures. From OpenBSD.
https://marc.info/?l=openbsd-cvs&m=113227249626888&w=2

Define the CS/80 identify structure only once and correctly, instead of
duplicating it in every CS/80 driver and using an hardcoded number for
its size.
No functional change.
https://marc.info/?l=openbsd-cvs&m=113273001020159&w=2

Pick HP-IB describe structures changes from main kernel code here as well.

Add support of multiple rd(4) disks on all punits for HPDisk.

Special thanks to Anders Gustafsson, the author of "HPDisk"
(GPIB disk emulator) http://www.dalton.ax/hpdisk/
for providing bare boards and improving firmwares for NetBSD/hp300.

Specify -fno-unwind-tables to shrink binaries.

Before:
text data bss dec hex filename
77902 4328 137120 219350 358d6 uboot

After:
text data bss dec hex filename
64186 4328 137120 205634 32342 uboot

Create rd3 device nodes, for HPDisk.

Add Device and drive info of 2202A, 7908A, 7911A, and 7941A.

Geometries and description info are taken from hpdrive.ini.sample
in HPDrive. Briefly tested on HPDisk.

Print rd(4) capacity and geometry info as sd(4) and wd(4) do.

Before:
rd0 at hpibbus1 slave 0 punit 0: 7937H
rd0: 698 cylinders, 13 heads, 1116102 blocks, 512 bytes/block

After:
rd0 at hpibbus1 slave 0 punit 0: 7937H
rd0: 544 MB, 698 cyl, 13 head, 123 sec, 512 bytes/block x 1116102 blocks
 1.15.2.1 22-Jun-2024  martin Pull up following revision(s) (requested by tsutsui in ticket #722):

sys/fs/cd9660/cd9660_util.c: revision 1.16
sys/arch/hp300/stand/common/clock.c: revision 1.14
sys/arch/hp300/stand/common/scsireg.h: revision 1.5
sys/arch/hp300/stand/common/scsireg.h: revision 1.6
sys/arch/hp300/stand/Makefile.buildboot: revision 1.38
sys/arch/hp300/include/bus.h: revision 1.23
sys/arch/hp300/stand/Makefile.buildboot: revision 1.39
sys/arch/hp300/stand/common/sd.c: revision 1.12
sys/arch/hp300/stand/common/prf.c: revision 1.6
sys/arch/hp300/stand/common/sd.c: revision 1.13
usr.sbin/installboot/installboot.8: revision 1.106
usr.sbin/installboot/Makefile: revision 1.59
sys/arch/hp300/stand/common/devopen.c: revision 1.14
usr.sbin/installboot/installboot.8: revision 1.107
sys/arch/hp300/stand/common/ite_dumb.c: revision 1.2
sys/arch/hp300/stand/common/devopen.c: revision 1.15
usr.sbin/installboot/installboot.8: revision 1.108
sys/fs/cd9660/cd9660_extern.h: revision 1.29
usr.sbin/installboot/installboot.8: revision 1.109
tools/Makefile.nbincludes: revision 1.11 (patch)
sys/arch/hp300/dev/rboxreg.h: revision 1.3
sys/arch/hp300/stand/common/scsivar.h: revision 1.5
sys/arch/hp300/dev/dnkbd.c: revision 1.14
sys/arch/hp300/hp300/trap.c: revision 1.156
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.12
sys/arch/hp300/dev/frodoreg.h: revision 1.6
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.13
sys/arch/hp300/stand/common/ite_sti.c: revision 1.2
sys/arch/hp300/stand/common/hil.c: revision 1.15
usr.sbin/installboot/arch/hp300.c: revision 1.18
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.14
sys/arch/hp300/dev/rbox.c: revision 1.4
usr.sbin/installboot/arch/hp300.c: revision 1.19
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.15
sys/sys/bootblock.h: revision 1.59
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.16
usr.sbin/installboot/installboot.h: revision 1.44
sys/arch/hp300/stand/mkboot/volhdr.h: file removal
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.17
sys/arch/hp300/dev/hpib.c: revision 1.45
usr.sbin/installboot/installboot.h: revision 1.45
usr.sbin/installboot/cd9660.c: revision 1.1
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.18
sys/arch/hp300/dev/topcatreg.h: revision 1.3
usr.sbin/installboot/cd9660.c: revision 1.2
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.19
sys/arch/hp300/stand/inst/inst.c: revision 1.25
sys/arch/hp300/stand/uboot/Makefile: revision 1.12
sys/arch/hp300/dev/dvbox.c: revision 1.4
sys/arch/hp300/dev/dma.c: revision 1.45
sys/arch/hp300/stand/uboot/Makefile: revision 1.13
sys/arch/hp300/stand/common/rd.c: revision 1.16
sys/arch/hp300/stand/inst/Makefile: revision 1.12
distrib/hp300/cdroms/installcd/Makefile: revision 1.4
sys/arch/hp300/stand/mkboot/volhdr.h: revision 1.6
sys/arch/hp300/stand/common/machdep.c: revision 1.16
usr.sbin/installboot/fstypes.c: revision 1.14
sys/arch/hp300/hp300/machdep.c: revision 1.238
sys/arch/hp300/include/cpu.h: revision 1.73
sys/arch/hp300/dev/diofbreg.h: revision 1.4
sys/arch/hp300/stand/common/scsi.c: revision 1.12
sys/arch/hp300/stand/common/netio.c: revision 1.19
sys/arch/hp300/stand/common/scsi.c: revision 1.13
sys/arch/hp300/dev/sti_sgc.c: revision 1.8
sys/arch/hp300/dev/rtc.c: revision 1.22
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.20
sys/arch/hp300/stand/common/conf.h: revision 1.4
sys/arch/hp300/hp300/autoconf.c: revision 1.111
sys/arch/hp300/stand/common/conf.c: revision 1.15
sys/arch/hp300/stand/mkboot/Makefile: revision 1.12
sys/arch/hp300/stand/mkboot/Makefile: revision 1.13
sys/arch/hp300/hp300/autoconf.c: revision 1.114
sys/arch/hp300/dev/dcmreg.h: revision 1.11
sys/arch/hp300/dev/diofbvar.h: revision 1.4
sys/arch/hp300/dev/dcm.c: revision 1.91
sys/fs/cd9660/cd9660_util.c: revision 1.15
sys/arch/hp300/dev/mcclock_frodo.c: revision 1.2

TAB/space cleanup.

installboot(8): formatting improvements

Use Ar foo instead of <foo>; this is mdoc.

Other formatting tweaks.
installboot(8): fix up markup

Don't overuse .Sy - when everything is highlighted, nothing is. Use
.Ic for options &c to get correct PostScript output (both are bold in
plain text).

Use Aq Ar inside .Pa, as both Pa and Ar are rendered as underscored
text in plain text output, and the distinction is lost.

Don't set examples in bold, but give them .Pp space around - they are
much easier to read this way.

Use consistent -width in FILES.
document how to use installboot on netbsd/vax.

PR/57909: Jan-Benedict Glaw: Don't include (build) timestamp when doing a
reproducible build
fix usage string, improve error handling.
add missing chunk for repro-build. fix gcc warnings.
avoid stringop truncation, fix copyright string to prevent assembler warnings.

Fix build as a tool (Jan-Benedict Glaw)

Fix integer overflow of strtol(3) for "loadpoint" address on ILP32 hosts.

This strtol(3) was introduced in rev 1.12 for PR/57909 after netbsd-10,
but it returns LONG_MAX (0x7FFFFFFF) for 0xFFF00000 on ILP32 hosts and
the wrong loadpoint causes "NOT ENOUGH MEMORY" error by the BOOTROMs
on loading uboot.lif on (at least) my 9000/360 and 9000/425t.

Misc cosmetic changes for mostly readability.
- KNF and add some newlines per blocks
- define and use proper bintobcd() macro
- make local functions and variables static

The same uboot.lif binaries are generated.

Rename ${PROGAOUT} -> ${PROGELF} to reflect reality.
Use proper signedness for the LIF file system data structures.

Ancient 4.3BSD used short and int for location, file size, file type,
and addresses etc. but all of them should be unsigned.

Also rename several variables and add comments for readability.
The LIF file system info can be found in "The HPDir Project" page:
https://www.hp9845.net/9845/projects/hpdir/
The same uboot.lif binaries are generated.

Add a preliminary CD boot support to uboot for preparation of PR/54455.
Briefly tested on mame, but not enalbed yet.

Recognize SCSI CD-ROM devices as a booted device properly.

Necessary for PR port-hp300/54455, to boot an md root root RAMDISK

kernel from CD-ROM without "WARNING: can't find match for bootdev:"
prompt.

Sync with src/sys/arch/hp300/stand/mkboot/volhdr.h rev 1.6.
https://mail-index.netbsd.org/source-changes/2024/05/07/msg151195.html

Use proper signedness for the LIF file system data structures.
mkboot should use this MI <sys/bootblock.h> and volhdr.h should
be removed soon.

Use MI <sys/bootblock.h> to refer LIF filesystem structures.
This should have been done when LIF definitions were initially added
to <sys/bootblock.h> for MI installboot(8).

Enable SUPPORT_CD on uboot.

Make cd9660_util.c usable in userland tools like installboot(8).

This was partially done for src/distrib/cdrom/macppc_installboot,
but more strict prototypes are necessary for native binary builds.

Install cd9660 related system headers for tools installboot(8) builds.

Reorder function prototypes per source files.

Add cd9660 support to search a bootloader file in the target file system.

Also add CD boot support for hp300, using a bootloader file in cd9660 fs.
This is a tool's part to close PR/54455.

HP 9000/300 machines read LIF directory entry allocated after
the LIF volume header at the top of the boot disk during bootstrap,
and a bootstrap file must be contiguously allocated on the disk
due to limitation of the LIF specification.

Current NetBSD/hp300's bootloader is larger than ~80KB so we have
to prepare a special 'boot' partition for FFS (that has only 8KB (ffsv1)
or 32KB (ffsv2) spaces) disks to put such a large bootloader.

On the other hand, on ISO9660 fs all files are allocated contiguously
so we can specify a bootloader file in the target ISO9660 directly
in the LIF directory entry.

Note we can simply use the existing "append" option to create bootable
CD ISO for hp300, but it looks some emulators (at leaset MAME) reject
such non-standard ISO files, i.e. with an appended bootloader file at
the end of the image.

Put a RAMDISK kernel and SYS_UBOOT into hp300 installcd to make it bootable.

This should finally close PR/54455.

Fix tools build errors on Cygwin.

Appease warnings on building tools/installboot on Cygwin.
 1.5 08-Feb-2011  rmind Remove clause 3 (UCB advertising clause) from the University of Utah
copyright. Confirmed by Mike Hibler, mike at cs.utah.edu - thanks!
Also, merge UCB and Utah copyright texts back into one, as they
originally were.

Extra verification by snj@.
 1.4 11-Dec-2005  christos branches: 1.4.100; 1.4.106; 1.4.108;
merge ktrace-lwp.
 1.3 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.2 27-May-2001  gmcgarry branches: 1.2.8; 1.2.24;
Alignment for on ELF systems. ELF bootblocks now work.
 1.1 04-Feb-1997  thorpej branches: 1.1.38;
Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.1.38.1 21-Jun-2001  nathanw Catch up to -current.
 1.2.24.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.24.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.24.1 03-Aug-2004  skrll Sync with HEAD
 1.2.8.2 27-May-2001  gmcgarry Alignment for on ELF systems. ELF bootblocks now work.
 1.2.8.1 27-May-2001  gmcgarry file rominfo.h was added on branch nathanw_sa on 2001-05-27 05:30:42 +0000
 1.4.108.1 17-Feb-2011  bouyer Sync with HEAD
 1.4.106.1 06-Jun-2011  jruoho Sync with HEAD.
 1.4.100.1 05-Mar-2011  rmind sync with head
 1.22 11-Dec-2022  tsutsui Make hp300 bootloaders UFS2 ready.
 1.21 11-Dec-2022  tsutsui Cleanup extern declarations.
 1.20 11-Jun-2016  dholland Change "tgets_s" back to "tgets". We obviously want to keep the bounds
argument, but there's no need to mess with the function name.
 1.19 05-Jun-2016  christos get rid of gets/tgets
 1.18 10-Aug-2014  isaki branches: 1.18.4;
Unify all arch/*/stand's atoi() to MI libsa.
lib/libsa/atoi.c was separated from lib/libsa/bootcfg.c.
PR/49084
 1.17 19-Apr-2014  tsutsui Add RTC support for HP9000/425e to bootloader too.

Also put several cleanup:
- make local functions and variables static
- use proper variable types
- some KNF

Note it turns out that extreme slowness of netboot on hp300 is
caused by the too slow access of the traditional RTC chip at intio
(i.e. netboot on 425e is so much faster than others). Oh well.
 1.16 16-Jul-2008  tsutsui branches: 1.16.28; 1.16.34; 1.16.38; 1.16.44; 1.16.54;
Change boot messages to replace build date and maker with kernrev.
 1.15 04-Mar-2007  christos branches: 1.15.40; 1.15.44; 1.15.46; 1.15.48; 1.15.50;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.14 02-Jul-2006  tsutsui branches: 1.14.10;
Rearrange DELAY() macro to use an asm statement so that we'll get more
proper delay.
 1.13 02-Jul-2006  tsutsui Use a volatile variable in DELAY() macro so that gcc4 won't omit it.
Fixes output corruption on DCA console boot.

XXX some mips ports have the similar macro in <machine/param.h>.
 1.12 25-Jun-2006  tsutsui - move declaration for sc_table from samachdep.h to device.h
- include <lib/libsa/stand.h> from samachdep.h for struct fs_ops
- remove unneeded declarations from samachdep.h
 1.11 01-Apr-2006  oster branches: 1.11.4;
Explicitly include <m68k/frame.h> here, rather than relying on it getting
pulled in via signal.h by accident.
 1.10 11-Dec-2005  christos branches: 1.10.4; 1.10.6; 1.10.8; 1.10.10; 1.10.12;
merge ktrace-lwp.
 1.9 14-Nov-2003  tsutsui branches: 1.9.14; 1.9.16; 1.9.26;
Misc cleanup:
- KNF
- WARNSfy
- remove __P()
- remove register declarations
- const'ify some variables
- make some local functions/variables static
- bcopy -> memcpy
- bcmp -> memcmp
- bzero -> memset
- space/TAB fix
etc.
 1.8 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.7 16-Mar-2002  gmcgarry branches: 1.7.12;
Move exec_hp300() out of uboot.c into its own file so that it can
be used by SYS_INST. SYS_INST can now boot ELF kernels inside the
miniroot.
 1.6 02-Jan-2001  simonb branches: 1.6.4; 1.6.8;
Convert both bootblocks and mkboot to use libsa's loadfile(), and make
both ELF aware.
 1.5 14-Dec-1999  thorpej Recode the kernel transfer point entirely in assembly to completely
avoid compiler surprises.
 1.4 31-Jul-1999  thorpej branches: 1.4.2; 1.4.8;
Fix oversight in last.
 1.3 12-May-1997  thorpej branches: 1.3.18;
- Define INTIOBASE here for use by the standalone programs.
- Add some extern's for "userom" and romputchar()
 1.2 27-Apr-1997  thorpej Don't define our own machineid values - pull in <machine/hp300spu.h>
 1.1 04-Feb-1997  thorpej Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.3.18.1 02-Aug-1999  thorpej Update from trunk.
 1.4.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.4.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.4.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.6.8.1 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.6.4.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.7.12.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.7.12.2 18-Sep-2004  skrll Sync with HEAD.
 1.7.12.1 03-Aug-2004  skrll Sync with HEAD
 1.9.26.1 06-Apr-2006  tron Pull up following revision(s) (requested by oster in ticket #1242):
sys/arch/hp300/stand/common/samachdep.h: revision 1.11
Explicitly include <m68k/frame.h> here, rather than relying on it getting
pulled in via signal.h by accident.
 1.9.16.3 03-Sep-2007  yamt sync with head.
 1.9.16.2 30-Dec-2006  yamt sync with head.
 1.9.16.1 21-Jun-2006  yamt sync with head.
 1.9.14.1 06-Apr-2006  tron Pull up following revision(s) (requested by oster in ticket #1242):
sys/arch/hp300/stand/common/samachdep.h: revision 1.11
Explicitly include <m68k/frame.h> here, rather than relying on it getting
pulled in via signal.h by accident.
 1.10.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.10.10.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.10.8.3 11-Aug-2006  yamt sync with head
 1.10.8.2 26-Jun-2006  yamt sync with head.
 1.10.8.1 11-Apr-2006  yamt sync with head
 1.10.6.1 22-Apr-2006  simonb Sync with head.
 1.10.4.1 09-Sep-2006  rpaulo sync with head
 1.11.4.1 13-Jul-2006  gdamore Merge from HEAD.
 1.14.10.1 12-Mar-2007  rmind Sync with HEAD.
 1.15.50.1 19-Oct-2008  haad Sync with HEAD.
 1.15.48.1 18-Jul-2008  simonb Sync with head.
 1.15.46.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.15.44.1 04-May-2009  yamt sync with head.
 1.15.40.1 28-Sep-2008  mjf Sync with HEAD.
 1.16.54.1 10-Aug-2014  tls Rebase.
 1.16.44.1 18-May-2014  rmind sync with head
 1.16.38.2 03-Dec-2017  jdolecek update from HEAD
 1.16.38.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.16.34.1 21-May-2014  bouyer Pull up following revision(s) (requested by tsutsui in ticket #1058):
sys/arch/hp300/conf/files.hp300: revision 1.88
sys/arch/hp300/include/autoconf.h: revision 1.13
sys/dev/ic/sti.c: revision 1.17
sys/arch/hp300/dev/frodo.c: revision 1.31
sys/arch/hp300/conf/GENERIC: revision 1.173
sys/arch/hp300/hp300/machdep.c: revision 1.229
sys/arch/hp300/dev/frodo.c: revision 1.32
sys/arch/hp300/hp300/autoconf.c: revision 1.102
sys/arch/hp300/dev/frodoreg.h: revision 1.5
sys/arch/hp300/stand/common/ite_sti.c: revision 1.1
sys/arch/hp300/stand/common/itevar.h: revision 1.16
sys/arch/hp300/hp300/autoconf.c: revision 1.105
sys/arch/hp300/dev/sti_sgcvar.h: revision 1.1
sys/arch/hp300/stand/common/apci.c: revision 1.12
sys/arch/hp300/stand/common/apci.c: revision 1.13
sys/arch/hp300/dev/dnkbd.c: revision 1.6
sys/arch/hp300/dev/dnkbd.c: revision 1.7
sys/arch/hp300/stand/inst/version: revision 1.12
sys/arch/hp300/dev/com_frodo.c: revision 1.9
sys/arch/hp300/stand/common/ite.c: revision 1.17
sys/arch/hp300/conf/GENERIC: revision 1.181
sys/arch/hp300/dev/sti_sgc.c: revision 1.1
sys/arch/hp300/stand/common/dnkbd.c: revision 1.13
sys/arch/hp300/dev/sti_sgc.c: revision 1.2
sys/dev/ic/stivar.h: revision 1.8
sys/arch/hp300/dev/rtc.c: revision 1.21
sys/arch/hp300/conf/INSTALL: revision 1.56
sys/arch/hp300/conf/INSTALL: revision 1.58
sys/arch/hp300/stand/uboot/version: revision 1.19
sys/arch/hp300/stand/common/samachdep.h: revision 1.17
sys/arch/hp300/stand/common/clock.c: revision 1.12
sys/arch/hp300/dev/mcclock_frodo.c: revision 1.1
sys/arch/hp300/stand/Makefile.buildboot: revision 1.34
sys/arch/hp300/conf/files.hp300: revision 1.87
Add sti at sgc framebuffer.
Ported from OpenBSD by kiyohara@.
Fix a botch on switching from apci (and dca) to MI com(4) 10 years ago.
I.e. fix apci device address per FRODO_BASE macro change
in frodoreg.h rev 1.2. Now bootloader works with serial console
on HP425e (which has only com at frodo).
Thanks to miod@openbsd for providing his 425e.
Add sti(4) at sgc screen console support. From (the late) OpenBSD/hp300.
Tested on HP9000/425e, which was sent from Miod Vallat and
demonstrated at Open Source unConference 2014 Kagawa.
Check the service switch on 425e to select apci serial console.
Taken from OpenBSD/hp300. See the following comment for details:
> * Check the service switch. On the 425e, this is a physical
> * switch, unlike other frodo-based machines, so we can use it
> * as a serial vs internal video selector, since the PROM can not
> * be configured for serial console.
Add proper RealTime Clock support for HP9000/425e.
As the OpenBSD/hp300 page says 425e doesn't have the traditional
RTC at intio (as it also lacks DCA 16550 serial at intio?),
but after a few hour investigation it turns out that
425e uses mc146818 compatible calendar clock in
the Apollo "frodo" utility chip and the frodo chip on
425e actually has the 32kHz OSC and is actually backed up
by the onboard lithium battery.
Tested on HP425e (with mcclock) and HP362 (with old rtc).
Add RTC support for HP9000/425e to bootloader too.
Also put several cleanup:
- make local functions and variables static
- use proper variable types
- some KNF
Note it turns out that extreme slowness of netboot on hp300 is
caused by the too slow access of the traditional RTC chip at intio
(i.e. netboot on 425e is so much faster than others). Oh well.
Add proper consinit(9) support for sti(4) at sgc framebuffer on hp300.
The cnattach functions for sti(4) and service switch check method
for 425e in com_frodo.c are taken from OpenBSD.
The strategy how to choose the console device in hp300_cninit() is
quite diverged from 4.4BSD and OpenBSD so it's tweaked by me.
Also put several changes in sti_sgc.c to reduce diffs from OpenBSD/hp300.
Tested on 425e and 362 (which still uses gendiofb(4), not sti(4)).
XXX: sti(4) requires uvm_km_alloc(9) and uvm_map_protect(9)
to copy and call ROM functions on the executable memory region, so
it can be called before UVM and related initializations are complete.
Probably it's time to consider about MI "deferred consinit()" API
in init_main.c (or elsewhere) for modern complicated VM system...
Also fix the apci device address in dnkbd.c as apci.c rev 1.12:
http://mail-index.netbsd.org/source-changes/2014/04/10/msg053940.html
Finally dnkbd(4) is confirmed working at least on bootloader.
Thanks again to Miod Vallat.
Make the Apollo Domain keyboard actually work.
Tested on HP9000/425e and the keyboard model A1630-82001 R2 (RX-60857-HW)
provided by Miod Vallat. Mouse support needs more work.
Pull random notes on the Apollo Domain keyboard from ancient PR/3528.
Bump versions to denote recent 425e related changes.
Probe mcclock only on 425e to avoid an extra "not configured" message.
Add and enable sti(4) at sgc in install kernels for 425e.
Tested on both serial console and framebuffer console.
(switched by the service switch on the back panel)
 1.16.28.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.18.4.1 09-Jul-2016  skrll Sync with HEAD
 1.13 09-May-2024  tsutsui Add a preliminary CD boot support to uboot for preparation of PR/54455.

Briefly tested on mame, but not enalbed yet.
 1.12 15-Jan-2023  tsutsui TAB/space cleanup.
 1.11 02-Jan-2014  tsutsui branches: 1.11.60;
Change the SCSI select timeout from 2ms to 250ms as kernel spc(4) driver does.

Noticed by miod@openbsd.
 1.10 08-Feb-2011  rmind branches: 1.10.4; 1.10.14; 1.10.18;
Remove clause 3 (UCB advertising clause) from the University of Utah
copyright. Confirmed by Mike Hibler, mike at cs.utah.edu - thanks!
Also, merge UCB and Utah copyright texts back into one, as they
originally were.

Extra verification by snj@.
 1.9 04-Mar-2007  christos branches: 1.9.66; 1.9.72; 1.9.74;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.8 25-Jun-2006  tsutsui branches: 1.8.10;
- use (uint8_t *) for scsi buffers
- u_char -> uint8_t for byte data
- use proper type variable
 1.7 11-Dec-2005  christos branches: 1.7.4; 1.7.8; 1.7.16;
merge ktrace-lwp.
 1.6 20-Feb-2005  tsutsui branches: 1.6.4;
Use ANSI function decls.
 1.5 14-Nov-2003  tsutsui branches: 1.5.8; 1.5.10;
Misc cleanup:
- KNF
- WARNSfy
- remove __P()
- remove register declarations
- const'ify some variables
- make some local functions/variables static
- bcopy -> memcpy
- bcmp -> memcmp
- bzero -> memset
- space/TAB fix
etc.
 1.4 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.3 01-Aug-2003  tsutsui Move dev/scsireg.h into stand/common since it is no longer used by kernel.
 1.2 20-Aug-2001  wiz branches: 1.2.6; 1.2.22;
"wierd" is weird.
 1.1 04-Feb-1997  thorpej branches: 1.1.40;
Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.1.40.1 25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.2.22.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 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 20-Aug-2001  wiz "wierd" is weird.
 1.2.6.1 20-Aug-2001  wiz file scsi.c was added on branch nathanw_sa on 2001-08-20 12:20:06 +0000
 1.5.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.5.8.1 29-Apr-2005  kent sync with -current
 1.6.4.2 03-Sep-2007  yamt sync with head.
 1.6.4.1 30-Dec-2006  yamt sync with head.
 1.7.16.1 13-Jul-2006  gdamore Merge from HEAD.
 1.7.8.1 26-Jun-2006  yamt sync with head.
 1.7.4.1 09-Sep-2006  rpaulo sync with head
 1.8.10.1 12-Mar-2007  rmind Sync with HEAD.
 1.9.74.1 17-Feb-2011  bouyer Sync with HEAD
 1.9.72.1 06-Jun-2011  jruoho Sync with HEAD.
 1.9.66.1 05-Mar-2011  rmind sync with head
 1.10.18.1 18-May-2014  rmind sync with head
 1.10.14.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.10.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.11.60.1 22-Jun-2024  martin Pull up following revision(s) (requested by tsutsui in ticket #722):

sys/fs/cd9660/cd9660_util.c: revision 1.16
sys/arch/hp300/stand/common/clock.c: revision 1.14
sys/arch/hp300/stand/common/scsireg.h: revision 1.5
sys/arch/hp300/stand/common/scsireg.h: revision 1.6
sys/arch/hp300/stand/Makefile.buildboot: revision 1.38
sys/arch/hp300/include/bus.h: revision 1.23
sys/arch/hp300/stand/Makefile.buildboot: revision 1.39
sys/arch/hp300/stand/common/sd.c: revision 1.12
sys/arch/hp300/stand/common/prf.c: revision 1.6
sys/arch/hp300/stand/common/sd.c: revision 1.13
usr.sbin/installboot/installboot.8: revision 1.106
usr.sbin/installboot/Makefile: revision 1.59
sys/arch/hp300/stand/common/devopen.c: revision 1.14
usr.sbin/installboot/installboot.8: revision 1.107
sys/arch/hp300/stand/common/ite_dumb.c: revision 1.2
sys/arch/hp300/stand/common/devopen.c: revision 1.15
usr.sbin/installboot/installboot.8: revision 1.108
sys/fs/cd9660/cd9660_extern.h: revision 1.29
usr.sbin/installboot/installboot.8: revision 1.109
tools/Makefile.nbincludes: revision 1.11 (patch)
sys/arch/hp300/dev/rboxreg.h: revision 1.3
sys/arch/hp300/stand/common/scsivar.h: revision 1.5
sys/arch/hp300/dev/dnkbd.c: revision 1.14
sys/arch/hp300/hp300/trap.c: revision 1.156
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.12
sys/arch/hp300/dev/frodoreg.h: revision 1.6
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.13
sys/arch/hp300/stand/common/ite_sti.c: revision 1.2
sys/arch/hp300/stand/common/hil.c: revision 1.15
usr.sbin/installboot/arch/hp300.c: revision 1.18
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.14
sys/arch/hp300/dev/rbox.c: revision 1.4
usr.sbin/installboot/arch/hp300.c: revision 1.19
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.15
sys/sys/bootblock.h: revision 1.59
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.16
usr.sbin/installboot/installboot.h: revision 1.44
sys/arch/hp300/stand/mkboot/volhdr.h: file removal
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.17
sys/arch/hp300/dev/hpib.c: revision 1.45
usr.sbin/installboot/installboot.h: revision 1.45
usr.sbin/installboot/cd9660.c: revision 1.1
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.18
sys/arch/hp300/dev/topcatreg.h: revision 1.3
usr.sbin/installboot/cd9660.c: revision 1.2
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.19
sys/arch/hp300/stand/inst/inst.c: revision 1.25
sys/arch/hp300/stand/uboot/Makefile: revision 1.12
sys/arch/hp300/dev/dvbox.c: revision 1.4
sys/arch/hp300/dev/dma.c: revision 1.45
sys/arch/hp300/stand/uboot/Makefile: revision 1.13
sys/arch/hp300/stand/common/rd.c: revision 1.16
sys/arch/hp300/stand/inst/Makefile: revision 1.12
distrib/hp300/cdroms/installcd/Makefile: revision 1.4
sys/arch/hp300/stand/mkboot/volhdr.h: revision 1.6
sys/arch/hp300/stand/common/machdep.c: revision 1.16
usr.sbin/installboot/fstypes.c: revision 1.14
sys/arch/hp300/hp300/machdep.c: revision 1.238
sys/arch/hp300/include/cpu.h: revision 1.73
sys/arch/hp300/dev/diofbreg.h: revision 1.4
sys/arch/hp300/stand/common/scsi.c: revision 1.12
sys/arch/hp300/stand/common/netio.c: revision 1.19
sys/arch/hp300/stand/common/scsi.c: revision 1.13
sys/arch/hp300/dev/sti_sgc.c: revision 1.8
sys/arch/hp300/dev/rtc.c: revision 1.22
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.20
sys/arch/hp300/stand/common/conf.h: revision 1.4
sys/arch/hp300/hp300/autoconf.c: revision 1.111
sys/arch/hp300/stand/common/conf.c: revision 1.15
sys/arch/hp300/stand/mkboot/Makefile: revision 1.12
sys/arch/hp300/stand/mkboot/Makefile: revision 1.13
sys/arch/hp300/hp300/autoconf.c: revision 1.114
sys/arch/hp300/dev/dcmreg.h: revision 1.11
sys/arch/hp300/dev/diofbvar.h: revision 1.4
sys/arch/hp300/dev/dcm.c: revision 1.91
sys/fs/cd9660/cd9660_util.c: revision 1.15
sys/arch/hp300/dev/mcclock_frodo.c: revision 1.2

TAB/space cleanup.

installboot(8): formatting improvements

Use Ar foo instead of <foo>; this is mdoc.

Other formatting tweaks.
installboot(8): fix up markup

Don't overuse .Sy - when everything is highlighted, nothing is. Use
.Ic for options &c to get correct PostScript output (both are bold in
plain text).

Use Aq Ar inside .Pa, as both Pa and Ar are rendered as underscored
text in plain text output, and the distinction is lost.

Don't set examples in bold, but give them .Pp space around - they are
much easier to read this way.

Use consistent -width in FILES.
document how to use installboot on netbsd/vax.

PR/57909: Jan-Benedict Glaw: Don't include (build) timestamp when doing a
reproducible build
fix usage string, improve error handling.
add missing chunk for repro-build. fix gcc warnings.
avoid stringop truncation, fix copyright string to prevent assembler warnings.

Fix build as a tool (Jan-Benedict Glaw)

Fix integer overflow of strtol(3) for "loadpoint" address on ILP32 hosts.

This strtol(3) was introduced in rev 1.12 for PR/57909 after netbsd-10,
but it returns LONG_MAX (0x7FFFFFFF) for 0xFFF00000 on ILP32 hosts and
the wrong loadpoint causes "NOT ENOUGH MEMORY" error by the BOOTROMs
on loading uboot.lif on (at least) my 9000/360 and 9000/425t.

Misc cosmetic changes for mostly readability.
- KNF and add some newlines per blocks
- define and use proper bintobcd() macro
- make local functions and variables static

The same uboot.lif binaries are generated.

Rename ${PROGAOUT} -> ${PROGELF} to reflect reality.
Use proper signedness for the LIF file system data structures.

Ancient 4.3BSD used short and int for location, file size, file type,
and addresses etc. but all of them should be unsigned.

Also rename several variables and add comments for readability.
The LIF file system info can be found in "The HPDir Project" page:
https://www.hp9845.net/9845/projects/hpdir/
The same uboot.lif binaries are generated.

Add a preliminary CD boot support to uboot for preparation of PR/54455.
Briefly tested on mame, but not enalbed yet.

Recognize SCSI CD-ROM devices as a booted device properly.

Necessary for PR port-hp300/54455, to boot an md root root RAMDISK

kernel from CD-ROM without "WARNING: can't find match for bootdev:"
prompt.

Sync with src/sys/arch/hp300/stand/mkboot/volhdr.h rev 1.6.
https://mail-index.netbsd.org/source-changes/2024/05/07/msg151195.html

Use proper signedness for the LIF file system data structures.
mkboot should use this MI <sys/bootblock.h> and volhdr.h should
be removed soon.

Use MI <sys/bootblock.h> to refer LIF filesystem structures.
This should have been done when LIF definitions were initially added
to <sys/bootblock.h> for MI installboot(8).

Enable SUPPORT_CD on uboot.

Make cd9660_util.c usable in userland tools like installboot(8).

This was partially done for src/distrib/cdrom/macppc_installboot,
but more strict prototypes are necessary for native binary builds.

Install cd9660 related system headers for tools installboot(8) builds.

Reorder function prototypes per source files.

Add cd9660 support to search a bootloader file in the target file system.

Also add CD boot support for hp300, using a bootloader file in cd9660 fs.
This is a tool's part to close PR/54455.

HP 9000/300 machines read LIF directory entry allocated after
the LIF volume header at the top of the boot disk during bootstrap,
and a bootstrap file must be contiguously allocated on the disk
due to limitation of the LIF specification.

Current NetBSD/hp300's bootloader is larger than ~80KB so we have
to prepare a special 'boot' partition for FFS (that has only 8KB (ffsv1)
or 32KB (ffsv2) spaces) disks to put such a large bootloader.

On the other hand, on ISO9660 fs all files are allocated contiguously
so we can specify a bootloader file in the target ISO9660 directly
in the LIF directory entry.

Note we can simply use the existing "append" option to create bootable
CD ISO for hp300, but it looks some emulators (at leaset MAME) reject
such non-standard ISO files, i.e. with an appended bootloader file at
the end of the image.

Put a RAMDISK kernel and SYS_UBOOT into hp300 installcd to make it bootable.

This should finally close PR/54455.

Fix tools build errors on Cygwin.

Appease warnings on building tools/installboot on Cygwin.
 1.6 09-May-2024  tsutsui Add a preliminary CD boot support to uboot for preparation of PR/54455.

Briefly tested on mame, but not enalbed yet.
 1.5 15-Jan-2023  tsutsui TAB/space cleanup.
 1.4 07-Sep-2015  dholland branches: 1.4.48;
Final bit of PR 41200: headers that declare ioctls should include sys/ioccom.h.
This covers most if not all of the MD headers.

XXX: a lot of the ioctl definitions in some of these files are cutpasted.
 1.3 08-Feb-2011  rmind branches: 1.3.14; 1.3.32;
Remove clause 3 (UCB advertising clause) from the University of Utah
copyright. Confirmed by Mike Hibler, mike at cs.utah.edu - thanks!
Also, merge UCB and Utah copyright texts back into one, as they
originally were.

Extra verification by snj@.
 1.2 11-Dec-2005  christos branches: 1.2.100; 1.2.106; 1.2.108;
merge ktrace-lwp.
 1.1 01-Aug-2003  tsutsui branches: 1.1.4;
Move dev/scsireg.h into stand/common since it is no longer used by kernel.
 1.1.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.1.4.2 03-Aug-2004  skrll Sync with HEAD
 1.1.4.1 01-Aug-2003  skrll file scsireg.h was added on branch ktrace-lwp on 2004-08-03 10:34:38 +0000
 1.2.108.1 17-Feb-2011  bouyer Sync with HEAD
 1.2.106.1 06-Jun-2011  jruoho Sync with HEAD.
 1.2.100.1 05-Mar-2011  rmind sync with head
 1.3.32.1 22-Sep-2015  skrll Sync with HEAD
 1.3.14.1 03-Dec-2017  jdolecek update from HEAD
 1.4.48.1 22-Jun-2024  martin Pull up following revision(s) (requested by tsutsui in ticket #722):

sys/fs/cd9660/cd9660_util.c: revision 1.16
sys/arch/hp300/stand/common/clock.c: revision 1.14
sys/arch/hp300/stand/common/scsireg.h: revision 1.5
sys/arch/hp300/stand/common/scsireg.h: revision 1.6
sys/arch/hp300/stand/Makefile.buildboot: revision 1.38
sys/arch/hp300/include/bus.h: revision 1.23
sys/arch/hp300/stand/Makefile.buildboot: revision 1.39
sys/arch/hp300/stand/common/sd.c: revision 1.12
sys/arch/hp300/stand/common/prf.c: revision 1.6
sys/arch/hp300/stand/common/sd.c: revision 1.13
usr.sbin/installboot/installboot.8: revision 1.106
usr.sbin/installboot/Makefile: revision 1.59
sys/arch/hp300/stand/common/devopen.c: revision 1.14
usr.sbin/installboot/installboot.8: revision 1.107
sys/arch/hp300/stand/common/ite_dumb.c: revision 1.2
sys/arch/hp300/stand/common/devopen.c: revision 1.15
usr.sbin/installboot/installboot.8: revision 1.108
sys/fs/cd9660/cd9660_extern.h: revision 1.29
usr.sbin/installboot/installboot.8: revision 1.109
tools/Makefile.nbincludes: revision 1.11 (patch)
sys/arch/hp300/dev/rboxreg.h: revision 1.3
sys/arch/hp300/stand/common/scsivar.h: revision 1.5
sys/arch/hp300/dev/dnkbd.c: revision 1.14
sys/arch/hp300/hp300/trap.c: revision 1.156
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.12
sys/arch/hp300/dev/frodoreg.h: revision 1.6
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.13
sys/arch/hp300/stand/common/ite_sti.c: revision 1.2
sys/arch/hp300/stand/common/hil.c: revision 1.15
usr.sbin/installboot/arch/hp300.c: revision 1.18
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.14
sys/arch/hp300/dev/rbox.c: revision 1.4
usr.sbin/installboot/arch/hp300.c: revision 1.19
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.15
sys/sys/bootblock.h: revision 1.59
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.16
usr.sbin/installboot/installboot.h: revision 1.44
sys/arch/hp300/stand/mkboot/volhdr.h: file removal
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.17
sys/arch/hp300/dev/hpib.c: revision 1.45
usr.sbin/installboot/installboot.h: revision 1.45
usr.sbin/installboot/cd9660.c: revision 1.1
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.18
sys/arch/hp300/dev/topcatreg.h: revision 1.3
usr.sbin/installboot/cd9660.c: revision 1.2
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.19
sys/arch/hp300/stand/inst/inst.c: revision 1.25
sys/arch/hp300/stand/uboot/Makefile: revision 1.12
sys/arch/hp300/dev/dvbox.c: revision 1.4
sys/arch/hp300/dev/dma.c: revision 1.45
sys/arch/hp300/stand/uboot/Makefile: revision 1.13
sys/arch/hp300/stand/common/rd.c: revision 1.16
sys/arch/hp300/stand/inst/Makefile: revision 1.12
distrib/hp300/cdroms/installcd/Makefile: revision 1.4
sys/arch/hp300/stand/mkboot/volhdr.h: revision 1.6
sys/arch/hp300/stand/common/machdep.c: revision 1.16
usr.sbin/installboot/fstypes.c: revision 1.14
sys/arch/hp300/hp300/machdep.c: revision 1.238
sys/arch/hp300/include/cpu.h: revision 1.73
sys/arch/hp300/dev/diofbreg.h: revision 1.4
sys/arch/hp300/stand/common/scsi.c: revision 1.12
sys/arch/hp300/stand/common/netio.c: revision 1.19
sys/arch/hp300/stand/common/scsi.c: revision 1.13
sys/arch/hp300/dev/sti_sgc.c: revision 1.8
sys/arch/hp300/dev/rtc.c: revision 1.22
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.20
sys/arch/hp300/stand/common/conf.h: revision 1.4
sys/arch/hp300/hp300/autoconf.c: revision 1.111
sys/arch/hp300/stand/common/conf.c: revision 1.15
sys/arch/hp300/stand/mkboot/Makefile: revision 1.12
sys/arch/hp300/stand/mkboot/Makefile: revision 1.13
sys/arch/hp300/hp300/autoconf.c: revision 1.114
sys/arch/hp300/dev/dcmreg.h: revision 1.11
sys/arch/hp300/dev/diofbvar.h: revision 1.4
sys/arch/hp300/dev/dcm.c: revision 1.91
sys/fs/cd9660/cd9660_util.c: revision 1.15
sys/arch/hp300/dev/mcclock_frodo.c: revision 1.2

TAB/space cleanup.

installboot(8): formatting improvements

Use Ar foo instead of <foo>; this is mdoc.

Other formatting tweaks.
installboot(8): fix up markup

Don't overuse .Sy - when everything is highlighted, nothing is. Use
.Ic for options &c to get correct PostScript output (both are bold in
plain text).

Use Aq Ar inside .Pa, as both Pa and Ar are rendered as underscored
text in plain text output, and the distinction is lost.

Don't set examples in bold, but give them .Pp space around - they are
much easier to read this way.

Use consistent -width in FILES.
document how to use installboot on netbsd/vax.

PR/57909: Jan-Benedict Glaw: Don't include (build) timestamp when doing a
reproducible build
fix usage string, improve error handling.
add missing chunk for repro-build. fix gcc warnings.
avoid stringop truncation, fix copyright string to prevent assembler warnings.

Fix build as a tool (Jan-Benedict Glaw)

Fix integer overflow of strtol(3) for "loadpoint" address on ILP32 hosts.

This strtol(3) was introduced in rev 1.12 for PR/57909 after netbsd-10,
but it returns LONG_MAX (0x7FFFFFFF) for 0xFFF00000 on ILP32 hosts and
the wrong loadpoint causes "NOT ENOUGH MEMORY" error by the BOOTROMs
on loading uboot.lif on (at least) my 9000/360 and 9000/425t.

Misc cosmetic changes for mostly readability.
- KNF and add some newlines per blocks
- define and use proper bintobcd() macro
- make local functions and variables static

The same uboot.lif binaries are generated.

Rename ${PROGAOUT} -> ${PROGELF} to reflect reality.
Use proper signedness for the LIF file system data structures.

Ancient 4.3BSD used short and int for location, file size, file type,
and addresses etc. but all of them should be unsigned.

Also rename several variables and add comments for readability.
The LIF file system info can be found in "The HPDir Project" page:
https://www.hp9845.net/9845/projects/hpdir/
The same uboot.lif binaries are generated.

Add a preliminary CD boot support to uboot for preparation of PR/54455.
Briefly tested on mame, but not enalbed yet.

Recognize SCSI CD-ROM devices as a booted device properly.

Necessary for PR port-hp300/54455, to boot an md root root RAMDISK

kernel from CD-ROM without "WARNING: can't find match for bootdev:"
prompt.

Sync with src/sys/arch/hp300/stand/mkboot/volhdr.h rev 1.6.
https://mail-index.netbsd.org/source-changes/2024/05/07/msg151195.html

Use proper signedness for the LIF file system data structures.
mkboot should use this MI <sys/bootblock.h> and volhdr.h should
be removed soon.

Use MI <sys/bootblock.h> to refer LIF filesystem structures.
This should have been done when LIF definitions were initially added
to <sys/bootblock.h> for MI installboot(8).

Enable SUPPORT_CD on uboot.

Make cd9660_util.c usable in userland tools like installboot(8).

This was partially done for src/distrib/cdrom/macppc_installboot,
but more strict prototypes are necessary for native binary builds.

Install cd9660 related system headers for tools installboot(8) builds.

Reorder function prototypes per source files.

Add cd9660 support to search a bootloader file in the target file system.

Also add CD boot support for hp300, using a bootloader file in cd9660 fs.
This is a tool's part to close PR/54455.

HP 9000/300 machines read LIF directory entry allocated after
the LIF volume header at the top of the boot disk during bootstrap,
and a bootstrap file must be contiguously allocated on the disk
due to limitation of the LIF specification.

Current NetBSD/hp300's bootloader is larger than ~80KB so we have
to prepare a special 'boot' partition for FFS (that has only 8KB (ffsv1)
or 32KB (ffsv2) spaces) disks to put such a large bootloader.

On the other hand, on ISO9660 fs all files are allocated contiguously
so we can specify a bootloader file in the target ISO9660 directly
in the LIF directory entry.

Note we can simply use the existing "append" option to create bootable
CD ISO for hp300, but it looks some emulators (at leaset MAME) reject
such non-standard ISO files, i.e. with an appended bootloader file at
the end of the image.

Put a RAMDISK kernel and SYS_UBOOT into hp300 installcd to make it bootable.

This should finally close PR/54455.

Fix tools build errors on Cygwin.

Appease warnings on building tools/installboot on Cygwin.
 1.5 09-May-2024  tsutsui Add a preliminary CD boot support to uboot for preparation of PR/54455.

Briefly tested on mame, but not enalbed yet.
 1.4 11-Dec-2005  christos branches: 1.4.196;
merge ktrace-lwp.
 1.3 14-Nov-2003  tsutsui Misc cleanup:
- KNF
- WARNSfy
- remove __P()
- remove register declarations
- const'ify some variables
- make some local functions/variables static
- bcopy -> memcpy
- bcmp -> memcmp
- bzero -> memset
- space/TAB fix
etc.
 1.2 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.1 04-Feb-1997  thorpej branches: 1.1.60;
Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.1.60.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.60.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.60.1 03-Aug-2004  skrll Sync with HEAD
 1.4.196.1 22-Jun-2024  martin Pull up following revision(s) (requested by tsutsui in ticket #722):

sys/fs/cd9660/cd9660_util.c: revision 1.16
sys/arch/hp300/stand/common/clock.c: revision 1.14
sys/arch/hp300/stand/common/scsireg.h: revision 1.5
sys/arch/hp300/stand/common/scsireg.h: revision 1.6
sys/arch/hp300/stand/Makefile.buildboot: revision 1.38
sys/arch/hp300/include/bus.h: revision 1.23
sys/arch/hp300/stand/Makefile.buildboot: revision 1.39
sys/arch/hp300/stand/common/sd.c: revision 1.12
sys/arch/hp300/stand/common/prf.c: revision 1.6
sys/arch/hp300/stand/common/sd.c: revision 1.13
usr.sbin/installboot/installboot.8: revision 1.106
usr.sbin/installboot/Makefile: revision 1.59
sys/arch/hp300/stand/common/devopen.c: revision 1.14
usr.sbin/installboot/installboot.8: revision 1.107
sys/arch/hp300/stand/common/ite_dumb.c: revision 1.2
sys/arch/hp300/stand/common/devopen.c: revision 1.15
usr.sbin/installboot/installboot.8: revision 1.108
sys/fs/cd9660/cd9660_extern.h: revision 1.29
usr.sbin/installboot/installboot.8: revision 1.109
tools/Makefile.nbincludes: revision 1.11 (patch)
sys/arch/hp300/dev/rboxreg.h: revision 1.3
sys/arch/hp300/stand/common/scsivar.h: revision 1.5
sys/arch/hp300/dev/dnkbd.c: revision 1.14
sys/arch/hp300/hp300/trap.c: revision 1.156
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.12
sys/arch/hp300/dev/frodoreg.h: revision 1.6
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.13
sys/arch/hp300/stand/common/ite_sti.c: revision 1.2
sys/arch/hp300/stand/common/hil.c: revision 1.15
usr.sbin/installboot/arch/hp300.c: revision 1.18
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.14
sys/arch/hp300/dev/rbox.c: revision 1.4
usr.sbin/installboot/arch/hp300.c: revision 1.19
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.15
sys/sys/bootblock.h: revision 1.59
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.16
usr.sbin/installboot/installboot.h: revision 1.44
sys/arch/hp300/stand/mkboot/volhdr.h: file removal
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.17
sys/arch/hp300/dev/hpib.c: revision 1.45
usr.sbin/installboot/installboot.h: revision 1.45
usr.sbin/installboot/cd9660.c: revision 1.1
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.18
sys/arch/hp300/dev/topcatreg.h: revision 1.3
usr.sbin/installboot/cd9660.c: revision 1.2
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.19
sys/arch/hp300/stand/inst/inst.c: revision 1.25
sys/arch/hp300/stand/uboot/Makefile: revision 1.12
sys/arch/hp300/dev/dvbox.c: revision 1.4
sys/arch/hp300/dev/dma.c: revision 1.45
sys/arch/hp300/stand/uboot/Makefile: revision 1.13
sys/arch/hp300/stand/common/rd.c: revision 1.16
sys/arch/hp300/stand/inst/Makefile: revision 1.12
distrib/hp300/cdroms/installcd/Makefile: revision 1.4
sys/arch/hp300/stand/mkboot/volhdr.h: revision 1.6
sys/arch/hp300/stand/common/machdep.c: revision 1.16
usr.sbin/installboot/fstypes.c: revision 1.14
sys/arch/hp300/hp300/machdep.c: revision 1.238
sys/arch/hp300/include/cpu.h: revision 1.73
sys/arch/hp300/dev/diofbreg.h: revision 1.4
sys/arch/hp300/stand/common/scsi.c: revision 1.12
sys/arch/hp300/stand/common/netio.c: revision 1.19
sys/arch/hp300/stand/common/scsi.c: revision 1.13
sys/arch/hp300/dev/sti_sgc.c: revision 1.8
sys/arch/hp300/dev/rtc.c: revision 1.22
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.20
sys/arch/hp300/stand/common/conf.h: revision 1.4
sys/arch/hp300/hp300/autoconf.c: revision 1.111
sys/arch/hp300/stand/common/conf.c: revision 1.15
sys/arch/hp300/stand/mkboot/Makefile: revision 1.12
sys/arch/hp300/stand/mkboot/Makefile: revision 1.13
sys/arch/hp300/hp300/autoconf.c: revision 1.114
sys/arch/hp300/dev/dcmreg.h: revision 1.11
sys/arch/hp300/dev/diofbvar.h: revision 1.4
sys/arch/hp300/dev/dcm.c: revision 1.91
sys/fs/cd9660/cd9660_util.c: revision 1.15
sys/arch/hp300/dev/mcclock_frodo.c: revision 1.2

TAB/space cleanup.

installboot(8): formatting improvements

Use Ar foo instead of <foo>; this is mdoc.

Other formatting tweaks.
installboot(8): fix up markup

Don't overuse .Sy - when everything is highlighted, nothing is. Use
.Ic for options &c to get correct PostScript output (both are bold in
plain text).

Use Aq Ar inside .Pa, as both Pa and Ar are rendered as underscored
text in plain text output, and the distinction is lost.

Don't set examples in bold, but give them .Pp space around - they are
much easier to read this way.

Use consistent -width in FILES.
document how to use installboot on netbsd/vax.

PR/57909: Jan-Benedict Glaw: Don't include (build) timestamp when doing a
reproducible build
fix usage string, improve error handling.
add missing chunk for repro-build. fix gcc warnings.
avoid stringop truncation, fix copyright string to prevent assembler warnings.

Fix build as a tool (Jan-Benedict Glaw)

Fix integer overflow of strtol(3) for "loadpoint" address on ILP32 hosts.

This strtol(3) was introduced in rev 1.12 for PR/57909 after netbsd-10,
but it returns LONG_MAX (0x7FFFFFFF) for 0xFFF00000 on ILP32 hosts and
the wrong loadpoint causes "NOT ENOUGH MEMORY" error by the BOOTROMs
on loading uboot.lif on (at least) my 9000/360 and 9000/425t.

Misc cosmetic changes for mostly readability.
- KNF and add some newlines per blocks
- define and use proper bintobcd() macro
- make local functions and variables static

The same uboot.lif binaries are generated.

Rename ${PROGAOUT} -> ${PROGELF} to reflect reality.
Use proper signedness for the LIF file system data structures.

Ancient 4.3BSD used short and int for location, file size, file type,
and addresses etc. but all of them should be unsigned.

Also rename several variables and add comments for readability.
The LIF file system info can be found in "The HPDir Project" page:
https://www.hp9845.net/9845/projects/hpdir/
The same uboot.lif binaries are generated.

Add a preliminary CD boot support to uboot for preparation of PR/54455.
Briefly tested on mame, but not enalbed yet.

Recognize SCSI CD-ROM devices as a booted device properly.

Necessary for PR port-hp300/54455, to boot an md root root RAMDISK

kernel from CD-ROM without "WARNING: can't find match for bootdev:"
prompt.

Sync with src/sys/arch/hp300/stand/mkboot/volhdr.h rev 1.6.
https://mail-index.netbsd.org/source-changes/2024/05/07/msg151195.html

Use proper signedness for the LIF file system data structures.
mkboot should use this MI <sys/bootblock.h> and volhdr.h should
be removed soon.

Use MI <sys/bootblock.h> to refer LIF filesystem structures.
This should have been done when LIF definitions were initially added
to <sys/bootblock.h> for MI installboot(8).

Enable SUPPORT_CD on uboot.

Make cd9660_util.c usable in userland tools like installboot(8).

This was partially done for src/distrib/cdrom/macppc_installboot,
but more strict prototypes are necessary for native binary builds.

Install cd9660 related system headers for tools installboot(8) builds.

Reorder function prototypes per source files.

Add cd9660 support to search a bootloader file in the target file system.

Also add CD boot support for hp300, using a bootloader file in cd9660 fs.
This is a tool's part to close PR/54455.

HP 9000/300 machines read LIF directory entry allocated after
the LIF volume header at the top of the boot disk during bootstrap,
and a bootstrap file must be contiguously allocated on the disk
due to limitation of the LIF specification.

Current NetBSD/hp300's bootloader is larger than ~80KB so we have
to prepare a special 'boot' partition for FFS (that has only 8KB (ffsv1)
or 32KB (ffsv2) spaces) disks to put such a large bootloader.

On the other hand, on ISO9660 fs all files are allocated contiguously
so we can specify a bootloader file in the target ISO9660 directly
in the LIF directory entry.

Note we can simply use the existing "append" option to create bootable
CD ISO for hp300, but it looks some emulators (at leaset MAME) reject
such non-standard ISO files, i.e. with an appended bootloader file at
the end of the image.

Put a RAMDISK kernel and SYS_UBOOT into hp300 installcd to make it bootable.

This should finally close PR/54455.

Fix tools build errors on Cygwin.

Appease warnings on building tools/installboot on Cygwin.
 1.13 09-May-2024  tsutsui Add a preliminary CD boot support to uboot for preparation of PR/54455.

Briefly tested on mame, but not enalbed yet.
 1.12 15-Jan-2023  tsutsui TAB/space cleanup.
 1.11 17-Jul-2011  joerg branches: 1.11.84;
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.10 08-Feb-2011  rmind Remove clause 3 (UCB advertising clause) from the University of Utah
copyright. Confirmed by Mike Hibler, mike at cs.utah.edu - thanks!
Also, merge UCB and Utah copyright texts back into one, as they
originally were.

Extra verification by snj@.
 1.9 04-Mar-2007  christos branches: 1.9.66; 1.9.72; 1.9.74;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.8 25-Jun-2006  tsutsui branches: 1.8.10;
- use (uint8_t *) for scsi buffers
- u_char -> uint8_t for byte data
- use proper type variable
 1.7 11-Dec-2005  christos branches: 1.7.4; 1.7.8; 1.7.16;
merge ktrace-lwp.
 1.6 20-Feb-2005  tsutsui branches: 1.6.4;
Use ANSI function decls.
 1.5 28-Aug-2004  thorpej branches: 1.5.4; 1.5.6;
Remove the last vestiges of COMPAT_NOLABEL. It's been 10 years; label
your disks already.
 1.4 14-Nov-2003  tsutsui Misc cleanup:
- KNF
- WARNSfy
- remove __P()
- remove register declarations
- const'ify some variables
- make some local functions/variables static
- bcopy -> memcpy
- bcmp -> memcmp
- bzero -> memset
- space/TAB fix
etc.
 1.3 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.2 01-Aug-2003  tsutsui Move dev/scsireg.h into stand/common since it is no longer used by kernel.
 1.1 04-Feb-1997  thorpej branches: 1.1.60;
Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.1.60.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.1.60.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.60.3 18-Sep-2004  skrll Sync with HEAD.
 1.1.60.2 03-Sep-2004  skrll Sync with HEAD
 1.1.60.1 03-Aug-2004  skrll Sync with HEAD
 1.5.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.5.4.1 29-Apr-2005  kent sync with -current
 1.6.4.2 03-Sep-2007  yamt sync with head.
 1.6.4.1 30-Dec-2006  yamt sync with head.
 1.7.16.1 13-Jul-2006  gdamore Merge from HEAD.
 1.7.8.1 26-Jun-2006  yamt sync with head.
 1.7.4.1 09-Sep-2006  rpaulo sync with head
 1.8.10.1 12-Mar-2007  rmind Sync with HEAD.
 1.9.74.1 17-Feb-2011  bouyer Sync with HEAD
 1.9.72.1 06-Jun-2011  jruoho Sync with HEAD.
 1.9.66.1 05-Mar-2011  rmind sync with head
 1.11.84.1 22-Jun-2024  martin Pull up following revision(s) (requested by tsutsui in ticket #722):

sys/fs/cd9660/cd9660_util.c: revision 1.16
sys/arch/hp300/stand/common/clock.c: revision 1.14
sys/arch/hp300/stand/common/scsireg.h: revision 1.5
sys/arch/hp300/stand/common/scsireg.h: revision 1.6
sys/arch/hp300/stand/Makefile.buildboot: revision 1.38
sys/arch/hp300/include/bus.h: revision 1.23
sys/arch/hp300/stand/Makefile.buildboot: revision 1.39
sys/arch/hp300/stand/common/sd.c: revision 1.12
sys/arch/hp300/stand/common/prf.c: revision 1.6
sys/arch/hp300/stand/common/sd.c: revision 1.13
usr.sbin/installboot/installboot.8: revision 1.106
usr.sbin/installboot/Makefile: revision 1.59
sys/arch/hp300/stand/common/devopen.c: revision 1.14
usr.sbin/installboot/installboot.8: revision 1.107
sys/arch/hp300/stand/common/ite_dumb.c: revision 1.2
sys/arch/hp300/stand/common/devopen.c: revision 1.15
usr.sbin/installboot/installboot.8: revision 1.108
sys/fs/cd9660/cd9660_extern.h: revision 1.29
usr.sbin/installboot/installboot.8: revision 1.109
tools/Makefile.nbincludes: revision 1.11 (patch)
sys/arch/hp300/dev/rboxreg.h: revision 1.3
sys/arch/hp300/stand/common/scsivar.h: revision 1.5
sys/arch/hp300/dev/dnkbd.c: revision 1.14
sys/arch/hp300/hp300/trap.c: revision 1.156
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.12
sys/arch/hp300/dev/frodoreg.h: revision 1.6
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.13
sys/arch/hp300/stand/common/ite_sti.c: revision 1.2
sys/arch/hp300/stand/common/hil.c: revision 1.15
usr.sbin/installboot/arch/hp300.c: revision 1.18
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.14
sys/arch/hp300/dev/rbox.c: revision 1.4
usr.sbin/installboot/arch/hp300.c: revision 1.19
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.15
sys/sys/bootblock.h: revision 1.59
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.16
usr.sbin/installboot/installboot.h: revision 1.44
sys/arch/hp300/stand/mkboot/volhdr.h: file removal
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.17
sys/arch/hp300/dev/hpib.c: revision 1.45
usr.sbin/installboot/installboot.h: revision 1.45
usr.sbin/installboot/cd9660.c: revision 1.1
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.18
sys/arch/hp300/dev/topcatreg.h: revision 1.3
usr.sbin/installboot/cd9660.c: revision 1.2
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.19
sys/arch/hp300/stand/inst/inst.c: revision 1.25
sys/arch/hp300/stand/uboot/Makefile: revision 1.12
sys/arch/hp300/dev/dvbox.c: revision 1.4
sys/arch/hp300/dev/dma.c: revision 1.45
sys/arch/hp300/stand/uboot/Makefile: revision 1.13
sys/arch/hp300/stand/common/rd.c: revision 1.16
sys/arch/hp300/stand/inst/Makefile: revision 1.12
distrib/hp300/cdroms/installcd/Makefile: revision 1.4
sys/arch/hp300/stand/mkboot/volhdr.h: revision 1.6
sys/arch/hp300/stand/common/machdep.c: revision 1.16
usr.sbin/installboot/fstypes.c: revision 1.14
sys/arch/hp300/hp300/machdep.c: revision 1.238
sys/arch/hp300/include/cpu.h: revision 1.73
sys/arch/hp300/dev/diofbreg.h: revision 1.4
sys/arch/hp300/stand/common/scsi.c: revision 1.12
sys/arch/hp300/stand/common/netio.c: revision 1.19
sys/arch/hp300/stand/common/scsi.c: revision 1.13
sys/arch/hp300/dev/sti_sgc.c: revision 1.8
sys/arch/hp300/dev/rtc.c: revision 1.22
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.20
sys/arch/hp300/stand/common/conf.h: revision 1.4
sys/arch/hp300/hp300/autoconf.c: revision 1.111
sys/arch/hp300/stand/common/conf.c: revision 1.15
sys/arch/hp300/stand/mkboot/Makefile: revision 1.12
sys/arch/hp300/stand/mkboot/Makefile: revision 1.13
sys/arch/hp300/hp300/autoconf.c: revision 1.114
sys/arch/hp300/dev/dcmreg.h: revision 1.11
sys/arch/hp300/dev/diofbvar.h: revision 1.4
sys/arch/hp300/dev/dcm.c: revision 1.91
sys/fs/cd9660/cd9660_util.c: revision 1.15
sys/arch/hp300/dev/mcclock_frodo.c: revision 1.2

TAB/space cleanup.

installboot(8): formatting improvements

Use Ar foo instead of <foo>; this is mdoc.

Other formatting tweaks.
installboot(8): fix up markup

Don't overuse .Sy - when everything is highlighted, nothing is. Use
.Ic for options &c to get correct PostScript output (both are bold in
plain text).

Use Aq Ar inside .Pa, as both Pa and Ar are rendered as underscored
text in plain text output, and the distinction is lost.

Don't set examples in bold, but give them .Pp space around - they are
much easier to read this way.

Use consistent -width in FILES.
document how to use installboot on netbsd/vax.

PR/57909: Jan-Benedict Glaw: Don't include (build) timestamp when doing a
reproducible build
fix usage string, improve error handling.
add missing chunk for repro-build. fix gcc warnings.
avoid stringop truncation, fix copyright string to prevent assembler warnings.

Fix build as a tool (Jan-Benedict Glaw)

Fix integer overflow of strtol(3) for "loadpoint" address on ILP32 hosts.

This strtol(3) was introduced in rev 1.12 for PR/57909 after netbsd-10,
but it returns LONG_MAX (0x7FFFFFFF) for 0xFFF00000 on ILP32 hosts and
the wrong loadpoint causes "NOT ENOUGH MEMORY" error by the BOOTROMs
on loading uboot.lif on (at least) my 9000/360 and 9000/425t.

Misc cosmetic changes for mostly readability.
- KNF and add some newlines per blocks
- define and use proper bintobcd() macro
- make local functions and variables static

The same uboot.lif binaries are generated.

Rename ${PROGAOUT} -> ${PROGELF} to reflect reality.
Use proper signedness for the LIF file system data structures.

Ancient 4.3BSD used short and int for location, file size, file type,
and addresses etc. but all of them should be unsigned.

Also rename several variables and add comments for readability.
The LIF file system info can be found in "The HPDir Project" page:
https://www.hp9845.net/9845/projects/hpdir/
The same uboot.lif binaries are generated.

Add a preliminary CD boot support to uboot for preparation of PR/54455.
Briefly tested on mame, but not enalbed yet.

Recognize SCSI CD-ROM devices as a booted device properly.

Necessary for PR port-hp300/54455, to boot an md root root RAMDISK

kernel from CD-ROM without "WARNING: can't find match for bootdev:"
prompt.

Sync with src/sys/arch/hp300/stand/mkboot/volhdr.h rev 1.6.
https://mail-index.netbsd.org/source-changes/2024/05/07/msg151195.html

Use proper signedness for the LIF file system data structures.
mkboot should use this MI <sys/bootblock.h> and volhdr.h should
be removed soon.

Use MI <sys/bootblock.h> to refer LIF filesystem structures.
This should have been done when LIF definitions were initially added
to <sys/bootblock.h> for MI installboot(8).

Enable SUPPORT_CD on uboot.

Make cd9660_util.c usable in userland tools like installboot(8).

This was partially done for src/distrib/cdrom/macppc_installboot,
but more strict prototypes are necessary for native binary builds.

Install cd9660 related system headers for tools installboot(8) builds.

Reorder function prototypes per source files.

Add cd9660 support to search a bootloader file in the target file system.

Also add CD boot support for hp300, using a bootloader file in cd9660 fs.
This is a tool's part to close PR/54455.

HP 9000/300 machines read LIF directory entry allocated after
the LIF volume header at the top of the boot disk during bootstrap,
and a bootstrap file must be contiguously allocated on the disk
due to limitation of the LIF specification.

Current NetBSD/hp300's bootloader is larger than ~80KB so we have
to prepare a special 'boot' partition for FFS (that has only 8KB (ffsv1)
or 32KB (ffsv2) spaces) disks to put such a large bootloader.

On the other hand, on ISO9660 fs all files are allocated contiguously
so we can specify a bootloader file in the target ISO9660 directly
in the LIF directory entry.

Note we can simply use the existing "append" option to create bootable
CD ISO for hp300, but it looks some emulators (at leaset MAME) reject
such non-standard ISO files, i.e. with an appended bootloader file at
the end of the image.

Put a RAMDISK kernel and SYS_UBOOT into hp300 installcd to make it bootable.

This should finally close PR/54455.

Fix tools build errors on Cygwin.

Appease warnings on building tools/installboot on Cygwin.
 1.17 08-Feb-2011  rmind Remove clause 3 (UCB advertising clause) from the University of Utah
copyright. Confirmed by Mike Hibler, mike at cs.utah.edu - thanks!
Also, merge UCB and Utah copyright texts back into one, as they
originally were.

Extra verification by snj@.
 1.16 27-Dec-2010  tsutsui branches: 1.16.2; 1.16.4;
With a quick test, HP9000/362 doesn't seem to have frodo utility chip,
so probe code to identify HP362 taken from OpenBSD has never worked.

Identify HP362 by probing device IDs of the on-board framebuffer instead.

---

>> NetBSD/hp300 Primary Boot, Revision 1.16 (from NetBSD 5.99.41)
>> HP 9000/362 SPU
>> Enter "reset" to reset system.
Boot: [[[sd0a:]netbsd][-a][-c][-d][-s][-v][-q]] :-
2836828+148212 [343504+216292]=0x361b24
Start @ 0xff003400 [1=0xff2dac50-0x361b24]...
Entry point: 0xff003400
Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
2006, 2007, 2008, 2009, 2010
The NetBSD Foundation, Inc. All rights reserved.
Copyright (c) 1982, 1986, 1989, 1991, 1993
The Regents of the University of California. All rights reserved.

NetBSD 5.99.41 (GENERIC) #135: Mon Dec 27 23:30:21 JST 2010
tsutsui@mirage:/usr/src/sys/arch/hp300/compile/GENERIC
HP 9000/362 (25MHz MC68030 CPU+MMU, 25MHz MC68882 FPU)
total memory = 16372 KB
avail memory = 11480 KB
:
 1.15 20-Jul-2006  tsutsui branches: 1.15.84;
Identify models HP362 and HP382. From OpenBSD, tested on my HP382.

Note now options HP362 and options HP382 are required for these models
in your kernel config file.
 1.14 19-Jul-2006  tsutsui Adjust comments.
 1.13 11-Dec-2005  christos branches: 1.13.4; 1.13.8;
merge ktrace-lwp.
 1.12 07-Aug-2003  agc branches: 1.12.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.11 14-Dec-1999  thorpej branches: 1.11.28;
Recode the kernel transfer point entirely in assembly to completely
avoid compiler surprises.
 1.10 11-Nov-1999  thorpej Add register prefixes.
 1.9 12-Aug-1999  thorpej branches: 1.9.2; 1.9.4; 1.9.8;
Use C-style comments.
 1.8 31-Jul-1999  thorpej If building without ITECONSOLE, don't install our own NMI handler. Just
leave the ROM's NMI handler in place.
 1.7 31-Jul-1999  thorpej Fix oversight in last.
 1.6 31-Jul-1999  thorpej Add 385 and 425e SPU detection. From OpenBSD.
 1.5 08-Feb-1999  he branches: 1.5.4;
Avoid "unterminated character constant" error from mkdep (really cc).
I guess in some sense it's stupid to use cc to depend .S files.
 1.4 12-May-1997  thorpej - Always build a romout() stub.
- If kbdnmi() returns, stop cold, since it shouldn't.
 1.3 27-Apr-1997  thorpej Uniquely identify 345 vs. 375 vs. 400 and 380 vs. 425. Adapted by me from
code provided by Mike Smith. While I'm here, convert this file to use
macros from <machine/asm.h> rather than making assumptions about how
C labels are handled.
 1.2 10-Mar-1997  thorpej Fix rounding of lowram value; ensure the kernel load address is on
an 8k boundary.
 1.1 04-Feb-1997  thorpej branches: 1.1.4;
Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.1.4.1 11-Mar-1997  is merge in changes from Trunk.
 1.5.4.1 02-Aug-1999  thorpej Update from trunk.
 1.9.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.9.4.1 15-Nov-1999  fvdl Sync with -current
 1.9.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.11.28.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.11.28.2 18-Sep-2004  skrll Sync with HEAD.
 1.11.28.1 03-Aug-2004  skrll Sync with HEAD
 1.12.16.1 30-Dec-2006  yamt sync with head.
 1.13.8.1 11-Aug-2006  yamt sync with head
 1.13.4.1 09-Sep-2006  rpaulo sync with head
 1.15.84.1 05-Mar-2011  rmind sync with head
 1.16.4.1 17-Feb-2011  bouyer Sync with HEAD
 1.16.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.3 27-Apr-1997  thorpej srt0.s renamed to srt0.S via repository copy Magick - we want this
file to be preprocessed before it is assembled.
 1.2 10-Mar-1997  thorpej Fix rounding of lowram value; ensure the kernel load address is on
an 8k boundary.
 1.1 04-Feb-1997  thorpej branches: 1.1.4;
Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.1.4.1 11-Mar-1997  is merge in changes from Trunk.
 1.8 11-Jun-2016  dholland Change "tgets_s" back to "tgets". We obviously want to keep the bounds
argument, but there's no need to mess with the function name.
 1.7 09-Jun-2016  christos return something
 1.6 05-Jun-2016  christos get rid of gets/tgets
 1.5 11-Dec-2005  christos branches: 1.5.122; 1.5.142;
merge ktrace-lwp.
 1.4 20-Feb-2005  tsutsui Use ANSI function decls.
 1.3 14-Nov-2003  tsutsui branches: 1.3.8; 1.3.10;
Misc cleanup:
- KNF
- WARNSfy
- remove __P()
- remove register declarations
- const'ify some variables
- make some local functions/variables static
- bcopy -> memcpy
- bcmp -> memcmp
- bzero -> memset
- space/TAB fix
etc.
 1.2 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.1 04-Feb-1997  thorpej branches: 1.1.60;
Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.1.60.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.1.60.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.60.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.60.1 03-Aug-2004  skrll Sync with HEAD
 1.3.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.3.8.1 29-Apr-2005  kent sync with -current
 1.5.142.1 09-Jul-2016  skrll Sync with HEAD
 1.5.122.1 03-Dec-2017  jdolecek update from HEAD
 1.12 07-May-2024  tsutsui Rename ${PROGAOUT} -> ${PROGELF} to reflect reality.
 1.11 29-Apr-2024  tsutsui Use LINKS to create hard links to generate proper METALOG files.

Also use the default ${PROG} variable and "install" target.

Fixes PR port-hp300/58211.
Should be pulled up to netbsd-10 and netbsd-9.
 1.10 23-Sep-2019  christos branches: 1.10.26;
Consistently use ${RELEASEDIR}/${RELEASEMACHINE} instead of
${RELEASEDIR}/${MACHINE} (Paul Ripke)
 1.9 11-Dec-2005  christos branches: 1.9.166; 1.9.170;
merge ktrace-lwp.
 1.8 02-Oct-2003  simonb White-space nit.
 1.7 03-Jan-2003  lukem branches: 1.7.2;
Install release files under "${RELEASEDIR}/${MACHINE}/..." instead of
"${RELEASEDIR}/...".

${RELEASEDIR} is never cleaned , and ${RELEASEDIR}/${MACHINE} is only
cleaned if UPDATE is not defined.
 1.6 14-Dec-2001  gmcgarry include Makefile.buildboot before testing for RELEASEDIR
 1.5 08-Nov-2001  gmcgarry branches: 1.5.2;
Make install observe ${INSTPRIV}
 1.4 23-Sep-2000  simonb branches: 1.4.4; 1.4.6;
Use ${COPY} instead of -c for ${INSTALL} commands.
 1.3 31-May-2000  he Add handling of "make release".
 1.2 14-Dec-1999  thorpej branches: 1.2.2;
Make it possible to strip this down a little more.
 1.1 04-Feb-1997  thorpej branches: 1.1.20; 1.1.26; 1.1.32;
Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.1.32.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.1.26.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.1.20.1 13-Jul-2000  he Pull up revision 1.3 (requested by he):
Enhance the ``make release'' process:
o Build and install the distrib and boot bits
 1.2.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.4.6.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.4.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.5.2.3 07-Jan-2003  thorpej Sync with HEAD.
 1.5.2.2 08-Jan-2002  nathanw Catch up to -current.
 1.5.2.1 08-Nov-2001  nathanw file Makefile was added on branch nathanw_sa on 2002-01-08 00:24:47 +0000
 1.7.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.7.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.7.2.1 03-Aug-2004  skrll Sync with HEAD
 1.9.170.1 11-May-2024  martin Pull up following revision(s) (requested by tsutsui in ticket #1838):

sys/arch/hp300/stand/uboot/Makefile: revision 1.11
sys/arch/hp300/stand/inst/Makefile: revision 1.11

Use LINKS to create hard links to generate proper METALOG files.

Also use the default ${PROG} variable and "install" target.

Fixes PR port-hp300/58211.
 1.9.166.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.10.26.2 22-Jun-2024  martin Pull up following revision(s) (requested by tsutsui in ticket #722):

sys/fs/cd9660/cd9660_util.c: revision 1.16
sys/arch/hp300/stand/common/clock.c: revision 1.14
sys/arch/hp300/stand/common/scsireg.h: revision 1.5
sys/arch/hp300/stand/common/scsireg.h: revision 1.6
sys/arch/hp300/stand/Makefile.buildboot: revision 1.38
sys/arch/hp300/include/bus.h: revision 1.23
sys/arch/hp300/stand/Makefile.buildboot: revision 1.39
sys/arch/hp300/stand/common/sd.c: revision 1.12
sys/arch/hp300/stand/common/prf.c: revision 1.6
sys/arch/hp300/stand/common/sd.c: revision 1.13
usr.sbin/installboot/installboot.8: revision 1.106
usr.sbin/installboot/Makefile: revision 1.59
sys/arch/hp300/stand/common/devopen.c: revision 1.14
usr.sbin/installboot/installboot.8: revision 1.107
sys/arch/hp300/stand/common/ite_dumb.c: revision 1.2
sys/arch/hp300/stand/common/devopen.c: revision 1.15
usr.sbin/installboot/installboot.8: revision 1.108
sys/fs/cd9660/cd9660_extern.h: revision 1.29
usr.sbin/installboot/installboot.8: revision 1.109
tools/Makefile.nbincludes: revision 1.11 (patch)
sys/arch/hp300/dev/rboxreg.h: revision 1.3
sys/arch/hp300/stand/common/scsivar.h: revision 1.5
sys/arch/hp300/dev/dnkbd.c: revision 1.14
sys/arch/hp300/hp300/trap.c: revision 1.156
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.12
sys/arch/hp300/dev/frodoreg.h: revision 1.6
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.13
sys/arch/hp300/stand/common/ite_sti.c: revision 1.2
sys/arch/hp300/stand/common/hil.c: revision 1.15
usr.sbin/installboot/arch/hp300.c: revision 1.18
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.14
sys/arch/hp300/dev/rbox.c: revision 1.4
usr.sbin/installboot/arch/hp300.c: revision 1.19
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.15
sys/sys/bootblock.h: revision 1.59
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.16
usr.sbin/installboot/installboot.h: revision 1.44
sys/arch/hp300/stand/mkboot/volhdr.h: file removal
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.17
sys/arch/hp300/dev/hpib.c: revision 1.45
usr.sbin/installboot/installboot.h: revision 1.45
usr.sbin/installboot/cd9660.c: revision 1.1
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.18
sys/arch/hp300/dev/topcatreg.h: revision 1.3
usr.sbin/installboot/cd9660.c: revision 1.2
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.19
sys/arch/hp300/stand/inst/inst.c: revision 1.25
sys/arch/hp300/stand/uboot/Makefile: revision 1.12
sys/arch/hp300/dev/dvbox.c: revision 1.4
sys/arch/hp300/dev/dma.c: revision 1.45
sys/arch/hp300/stand/uboot/Makefile: revision 1.13
sys/arch/hp300/stand/common/rd.c: revision 1.16
sys/arch/hp300/stand/inst/Makefile: revision 1.12
distrib/hp300/cdroms/installcd/Makefile: revision 1.4
sys/arch/hp300/stand/mkboot/volhdr.h: revision 1.6
sys/arch/hp300/stand/common/machdep.c: revision 1.16
usr.sbin/installboot/fstypes.c: revision 1.14
sys/arch/hp300/hp300/machdep.c: revision 1.238
sys/arch/hp300/include/cpu.h: revision 1.73
sys/arch/hp300/dev/diofbreg.h: revision 1.4
sys/arch/hp300/stand/common/scsi.c: revision 1.12
sys/arch/hp300/stand/common/netio.c: revision 1.19
sys/arch/hp300/stand/common/scsi.c: revision 1.13
sys/arch/hp300/dev/sti_sgc.c: revision 1.8
sys/arch/hp300/dev/rtc.c: revision 1.22
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.20
sys/arch/hp300/stand/common/conf.h: revision 1.4
sys/arch/hp300/hp300/autoconf.c: revision 1.111
sys/arch/hp300/stand/common/conf.c: revision 1.15
sys/arch/hp300/stand/mkboot/Makefile: revision 1.12
sys/arch/hp300/stand/mkboot/Makefile: revision 1.13
sys/arch/hp300/hp300/autoconf.c: revision 1.114
sys/arch/hp300/dev/dcmreg.h: revision 1.11
sys/arch/hp300/dev/diofbvar.h: revision 1.4
sys/arch/hp300/dev/dcm.c: revision 1.91
sys/fs/cd9660/cd9660_util.c: revision 1.15
sys/arch/hp300/dev/mcclock_frodo.c: revision 1.2

TAB/space cleanup.

installboot(8): formatting improvements

Use Ar foo instead of <foo>; this is mdoc.

Other formatting tweaks.
installboot(8): fix up markup

Don't overuse .Sy - when everything is highlighted, nothing is. Use
.Ic for options &c to get correct PostScript output (both are bold in
plain text).

Use Aq Ar inside .Pa, as both Pa and Ar are rendered as underscored
text in plain text output, and the distinction is lost.

Don't set examples in bold, but give them .Pp space around - they are
much easier to read this way.

Use consistent -width in FILES.
document how to use installboot on netbsd/vax.

PR/57909: Jan-Benedict Glaw: Don't include (build) timestamp when doing a
reproducible build
fix usage string, improve error handling.
add missing chunk for repro-build. fix gcc warnings.
avoid stringop truncation, fix copyright string to prevent assembler warnings.

Fix build as a tool (Jan-Benedict Glaw)

Fix integer overflow of strtol(3) for "loadpoint" address on ILP32 hosts.

This strtol(3) was introduced in rev 1.12 for PR/57909 after netbsd-10,
but it returns LONG_MAX (0x7FFFFFFF) for 0xFFF00000 on ILP32 hosts and
the wrong loadpoint causes "NOT ENOUGH MEMORY" error by the BOOTROMs
on loading uboot.lif on (at least) my 9000/360 and 9000/425t.

Misc cosmetic changes for mostly readability.
- KNF and add some newlines per blocks
- define and use proper bintobcd() macro
- make local functions and variables static

The same uboot.lif binaries are generated.

Rename ${PROGAOUT} -> ${PROGELF} to reflect reality.
Use proper signedness for the LIF file system data structures.

Ancient 4.3BSD used short and int for location, file size, file type,
and addresses etc. but all of them should be unsigned.

Also rename several variables and add comments for readability.
The LIF file system info can be found in "The HPDir Project" page:
https://www.hp9845.net/9845/projects/hpdir/
The same uboot.lif binaries are generated.

Add a preliminary CD boot support to uboot for preparation of PR/54455.
Briefly tested on mame, but not enalbed yet.

Recognize SCSI CD-ROM devices as a booted device properly.

Necessary for PR port-hp300/54455, to boot an md root root RAMDISK

kernel from CD-ROM without "WARNING: can't find match for bootdev:"
prompt.

Sync with src/sys/arch/hp300/stand/mkboot/volhdr.h rev 1.6.
https://mail-index.netbsd.org/source-changes/2024/05/07/msg151195.html

Use proper signedness for the LIF file system data structures.
mkboot should use this MI <sys/bootblock.h> and volhdr.h should
be removed soon.

Use MI <sys/bootblock.h> to refer LIF filesystem structures.
This should have been done when LIF definitions were initially added
to <sys/bootblock.h> for MI installboot(8).

Enable SUPPORT_CD on uboot.

Make cd9660_util.c usable in userland tools like installboot(8).

This was partially done for src/distrib/cdrom/macppc_installboot,
but more strict prototypes are necessary for native binary builds.

Install cd9660 related system headers for tools installboot(8) builds.

Reorder function prototypes per source files.

Add cd9660 support to search a bootloader file in the target file system.

Also add CD boot support for hp300, using a bootloader file in cd9660 fs.
This is a tool's part to close PR/54455.

HP 9000/300 machines read LIF directory entry allocated after
the LIF volume header at the top of the boot disk during bootstrap,
and a bootstrap file must be contiguously allocated on the disk
due to limitation of the LIF specification.

Current NetBSD/hp300's bootloader is larger than ~80KB so we have
to prepare a special 'boot' partition for FFS (that has only 8KB (ffsv1)
or 32KB (ffsv2) spaces) disks to put such a large bootloader.

On the other hand, on ISO9660 fs all files are allocated contiguously
so we can specify a bootloader file in the target ISO9660 directly
in the LIF directory entry.

Note we can simply use the existing "append" option to create bootable
CD ISO for hp300, but it looks some emulators (at leaset MAME) reject
such non-standard ISO files, i.e. with an appended bootloader file at
the end of the image.

Put a RAMDISK kernel and SYS_UBOOT into hp300 installcd to make it bootable.

This should finally close PR/54455.

Fix tools build errors on Cygwin.

Appease warnings on building tools/installboot on Cygwin.
 1.10.26.1 11-May-2024  martin Pull up following revision(s) (requested by tsutsui in ticket #684):

sys/arch/hp300/stand/uboot/Makefile: revision 1.11
sys/arch/hp300/stand/inst/Makefile: revision 1.11

Use LINKS to create hard links to generate proper METALOG files.

Also use the default ${PROG} variable and "install" target.

Fixes PR port-hp300/58211.
 1.25 15-Jan-2023  tsutsui TAB/space cleanup.
 1.24 11-Dec-2022  tsutsui branches: 1.24.2;
Cleanup extern declarations.
 1.23 04-Sep-2018  riastradh Fix some min/max -> uimin/uimax stragglers.

Confirmed by the 2018-09-04T04:40Z autobuild.
 1.22 11-Jun-2016  dholland branches: 1.22.16; 1.22.18;
gets_s -> kgets.

The exact name isn't that important; but it is important not to use
"gets_s" and thereby allow anyone to falsely get the impression we're
implementing Annex K. We aren't.

ok core.
 1.21 05-Jun-2016  christos get rid of gets
 1.20 10-Aug-2014  isaki branches: 1.20.4;
Unify all arch/*/stand's atoi() to MI libsa.
lib/libsa/atoi.c was separated from lib/libsa/bootcfg.c.
PR/49084
 1.19 21-Jun-2014  tsutsui Properly use an unused-but-set-variable. Also replace a magic number.
 1.18 16-Jul-2008  tsutsui branches: 1.18.38; 1.18.54;
Change boot messages to replace build date and maker with kernrev.
 1.17 28-Apr-2008  martin branches: 1.17.2; 1.17.4; 1.17.6;
Remove clause 3 and 4 from TNF licenses
 1.16 29-Dec-2007  tsutsui branches: 1.16.6; 1.16.8; 1.16.10;
Remove __P().
 1.15 24-Dec-2005  perry branches: 1.15.50; 1.15.56; 1.15.64;
bare asm -> __asm
 1.14 11-Dec-2005  christos merge ktrace-lwp.
 1.13 20-Feb-2005  tsutsui branches: 1.13.4;
Use ANSI function decls.
 1.12 02-Jan-2005  tsutsui branches: 1.12.2; 1.12.4;
u_intNN_t -> uintNN_t
 1.11 14-Nov-2003  tsutsui Misc cleanup:
- KNF
- WARNSfy
- remove __P()
- remove register declarations
- const'ify some variables
- make some local functions/variables static
- bcopy -> memcpy
- bcmp -> memcmp
- bzero -> memset
- space/TAB fix
etc.
 1.10 28-Jan-2003  wiz branches: 1.10.2;
success, not sucess. Noted by mjl.
 1.9 28-Jan-2003  wiz unknown, not unkown. Noted by mjl.
 1.8 30-May-2002  thorpej Don't use multi-line string literals.
 1.7 16-Mar-2002  gmcgarry branches: 1.7.4; 1.7.6;
Move exec_hp300() out of uboot.c into its own file so that it can
be used by SYS_INST. SYS_INST can now boot ELF kernels inside the
miniroot.
 1.6 29-Dec-1997  scottr branches: 1.6.28; 1.6.32;
Prompt for total sectors, and calculate sane defaults for sectors per
cylinder and total sectors.
 1.5 15-Dec-1997  thorpej Fill out more file system information, from Havard Eidnes, and hacked a bit
by me.
 1.4 04-Oct-1997  thorpej branches: 1.4.2;
Copyright assigned to The NetBSD Foundation.
 1.3 27-Apr-1997  thorpej branches: 1.3.4;
CPU -> SPU
 1.2 04-Feb-1997  thorpej - If copying the miniroot from an NFS server, don't attempt to
compute the number of iterations through the copy loop based
on file size; the miniroot image may be compressed. Instead,
ignore short reads in the NFS case, and handle them like EOF.
- Fix typo in a printf format.
 1.1 04-Feb-1997  thorpej Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.3.4.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.4.2.2 29-Dec-1997  perry pull up from trunk (scottr)
 1.4.2.1 15-Dec-1997  thorpej Sync w/ trunk: fill out more file system fields.
 1.6.32.2 20-Jun-2002  nathanw Catch up to -current.
 1.6.32.1 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.6.28.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.7.6.1 30-May-2002  tv Pull up revision 1.8 (requested by thorpej in ticket #89):
Don't use multi-line string literals.
 1.7.4.1 14-Jul-2002  gehenna catch up with -current.
 1.10.2.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.10.2.4 17-Jan-2005  skrll Sync with HEAD.
 1.10.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.10.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.10.2.1 03-Aug-2004  skrll Sync with HEAD
 1.12.4.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.12.2.1 29-Apr-2005  kent sync with -current
 1.13.4.2 21-Jan-2008  yamt sync with head
 1.13.4.1 21-Jun-2006  yamt sync with head.
 1.15.64.1 02-Jan-2008  bouyer Sync with HEAD
 1.15.56.1 18-Feb-2008  mjf Sync with HEAD.
 1.15.50.1 09-Jan-2008  matt sync with HEAD
 1.16.10.2 04-May-2009  yamt sync with head.
 1.16.10.1 16-May-2008  yamt sync with head.
 1.16.8.1 18-May-2008  yamt sync with head.
 1.16.6.2 28-Sep-2008  mjf Sync with HEAD.
 1.16.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.17.6.1 19-Oct-2008  haad Sync with HEAD.
 1.17.4.1 18-Jul-2008  simonb Sync with head.
 1.17.2.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.18.54.1 10-Aug-2014  tls Rebase.
 1.18.38.2 03-Dec-2017  jdolecek update from HEAD
 1.18.38.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.20.4.1 09-Jul-2016  skrll Sync with HEAD
 1.22.18.1 10-Jun-2019  christos Sync with HEAD
 1.22.16.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.24.2.1 22-Jun-2024  martin Pull up following revision(s) (requested by tsutsui in ticket #722):

sys/fs/cd9660/cd9660_util.c: revision 1.16
sys/arch/hp300/stand/common/clock.c: revision 1.14
sys/arch/hp300/stand/common/scsireg.h: revision 1.5
sys/arch/hp300/stand/common/scsireg.h: revision 1.6
sys/arch/hp300/stand/Makefile.buildboot: revision 1.38
sys/arch/hp300/include/bus.h: revision 1.23
sys/arch/hp300/stand/Makefile.buildboot: revision 1.39
sys/arch/hp300/stand/common/sd.c: revision 1.12
sys/arch/hp300/stand/common/prf.c: revision 1.6
sys/arch/hp300/stand/common/sd.c: revision 1.13
usr.sbin/installboot/installboot.8: revision 1.106
usr.sbin/installboot/Makefile: revision 1.59
sys/arch/hp300/stand/common/devopen.c: revision 1.14
usr.sbin/installboot/installboot.8: revision 1.107
sys/arch/hp300/stand/common/ite_dumb.c: revision 1.2
sys/arch/hp300/stand/common/devopen.c: revision 1.15
usr.sbin/installboot/installboot.8: revision 1.108
sys/fs/cd9660/cd9660_extern.h: revision 1.29
usr.sbin/installboot/installboot.8: revision 1.109
tools/Makefile.nbincludes: revision 1.11 (patch)
sys/arch/hp300/dev/rboxreg.h: revision 1.3
sys/arch/hp300/stand/common/scsivar.h: revision 1.5
sys/arch/hp300/dev/dnkbd.c: revision 1.14
sys/arch/hp300/hp300/trap.c: revision 1.156
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.12
sys/arch/hp300/dev/frodoreg.h: revision 1.6
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.13
sys/arch/hp300/stand/common/ite_sti.c: revision 1.2
sys/arch/hp300/stand/common/hil.c: revision 1.15
usr.sbin/installboot/arch/hp300.c: revision 1.18
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.14
sys/arch/hp300/dev/rbox.c: revision 1.4
usr.sbin/installboot/arch/hp300.c: revision 1.19
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.15
sys/sys/bootblock.h: revision 1.59
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.16
usr.sbin/installboot/installboot.h: revision 1.44
sys/arch/hp300/stand/mkboot/volhdr.h: file removal
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.17
sys/arch/hp300/dev/hpib.c: revision 1.45
usr.sbin/installboot/installboot.h: revision 1.45
usr.sbin/installboot/cd9660.c: revision 1.1
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.18
sys/arch/hp300/dev/topcatreg.h: revision 1.3
usr.sbin/installboot/cd9660.c: revision 1.2
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.19
sys/arch/hp300/stand/inst/inst.c: revision 1.25
sys/arch/hp300/stand/uboot/Makefile: revision 1.12
sys/arch/hp300/dev/dvbox.c: revision 1.4
sys/arch/hp300/dev/dma.c: revision 1.45
sys/arch/hp300/stand/uboot/Makefile: revision 1.13
sys/arch/hp300/stand/common/rd.c: revision 1.16
sys/arch/hp300/stand/inst/Makefile: revision 1.12
distrib/hp300/cdroms/installcd/Makefile: revision 1.4
sys/arch/hp300/stand/mkboot/volhdr.h: revision 1.6
sys/arch/hp300/stand/common/machdep.c: revision 1.16
usr.sbin/installboot/fstypes.c: revision 1.14
sys/arch/hp300/hp300/machdep.c: revision 1.238
sys/arch/hp300/include/cpu.h: revision 1.73
sys/arch/hp300/dev/diofbreg.h: revision 1.4
sys/arch/hp300/stand/common/scsi.c: revision 1.12
sys/arch/hp300/stand/common/netio.c: revision 1.19
sys/arch/hp300/stand/common/scsi.c: revision 1.13
sys/arch/hp300/dev/sti_sgc.c: revision 1.8
sys/arch/hp300/dev/rtc.c: revision 1.22
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.20
sys/arch/hp300/stand/common/conf.h: revision 1.4
sys/arch/hp300/hp300/autoconf.c: revision 1.111
sys/arch/hp300/stand/common/conf.c: revision 1.15
sys/arch/hp300/stand/mkboot/Makefile: revision 1.12
sys/arch/hp300/stand/mkboot/Makefile: revision 1.13
sys/arch/hp300/hp300/autoconf.c: revision 1.114
sys/arch/hp300/dev/dcmreg.h: revision 1.11
sys/arch/hp300/dev/diofbvar.h: revision 1.4
sys/arch/hp300/dev/dcm.c: revision 1.91
sys/fs/cd9660/cd9660_util.c: revision 1.15
sys/arch/hp300/dev/mcclock_frodo.c: revision 1.2

TAB/space cleanup.

installboot(8): formatting improvements

Use Ar foo instead of <foo>; this is mdoc.

Other formatting tweaks.
installboot(8): fix up markup

Don't overuse .Sy - when everything is highlighted, nothing is. Use
.Ic for options &c to get correct PostScript output (both are bold in
plain text).

Use Aq Ar inside .Pa, as both Pa and Ar are rendered as underscored
text in plain text output, and the distinction is lost.

Don't set examples in bold, but give them .Pp space around - they are
much easier to read this way.

Use consistent -width in FILES.
document how to use installboot on netbsd/vax.

PR/57909: Jan-Benedict Glaw: Don't include (build) timestamp when doing a
reproducible build
fix usage string, improve error handling.
add missing chunk for repro-build. fix gcc warnings.
avoid stringop truncation, fix copyright string to prevent assembler warnings.

Fix build as a tool (Jan-Benedict Glaw)

Fix integer overflow of strtol(3) for "loadpoint" address on ILP32 hosts.

This strtol(3) was introduced in rev 1.12 for PR/57909 after netbsd-10,
but it returns LONG_MAX (0x7FFFFFFF) for 0xFFF00000 on ILP32 hosts and
the wrong loadpoint causes "NOT ENOUGH MEMORY" error by the BOOTROMs
on loading uboot.lif on (at least) my 9000/360 and 9000/425t.

Misc cosmetic changes for mostly readability.
- KNF and add some newlines per blocks
- define and use proper bintobcd() macro
- make local functions and variables static

The same uboot.lif binaries are generated.

Rename ${PROGAOUT} -> ${PROGELF} to reflect reality.
Use proper signedness for the LIF file system data structures.

Ancient 4.3BSD used short and int for location, file size, file type,
and addresses etc. but all of them should be unsigned.

Also rename several variables and add comments for readability.
The LIF file system info can be found in "The HPDir Project" page:
https://www.hp9845.net/9845/projects/hpdir/
The same uboot.lif binaries are generated.

Add a preliminary CD boot support to uboot for preparation of PR/54455.
Briefly tested on mame, but not enalbed yet.

Recognize SCSI CD-ROM devices as a booted device properly.

Necessary for PR port-hp300/54455, to boot an md root root RAMDISK

kernel from CD-ROM without "WARNING: can't find match for bootdev:"
prompt.

Sync with src/sys/arch/hp300/stand/mkboot/volhdr.h rev 1.6.
https://mail-index.netbsd.org/source-changes/2024/05/07/msg151195.html

Use proper signedness for the LIF file system data structures.
mkboot should use this MI <sys/bootblock.h> and volhdr.h should
be removed soon.

Use MI <sys/bootblock.h> to refer LIF filesystem structures.
This should have been done when LIF definitions were initially added
to <sys/bootblock.h> for MI installboot(8).

Enable SUPPORT_CD on uboot.

Make cd9660_util.c usable in userland tools like installboot(8).

This was partially done for src/distrib/cdrom/macppc_installboot,
but more strict prototypes are necessary for native binary builds.

Install cd9660 related system headers for tools installboot(8) builds.

Reorder function prototypes per source files.

Add cd9660 support to search a bootloader file in the target file system.

Also add CD boot support for hp300, using a bootloader file in cd9660 fs.
This is a tool's part to close PR/54455.

HP 9000/300 machines read LIF directory entry allocated after
the LIF volume header at the top of the boot disk during bootstrap,
and a bootstrap file must be contiguously allocated on the disk
due to limitation of the LIF specification.

Current NetBSD/hp300's bootloader is larger than ~80KB so we have
to prepare a special 'boot' partition for FFS (that has only 8KB (ffsv1)
or 32KB (ffsv2) spaces) disks to put such a large bootloader.

On the other hand, on ISO9660 fs all files are allocated contiguously
so we can specify a bootloader file in the target ISO9660 directly
in the LIF directory entry.

Note we can simply use the existing "append" option to create bootable
CD ISO for hp300, but it looks some emulators (at leaset MAME) reject
such non-standard ISO files, i.e. with an appended bootloader file at
the end of the image.

Put a RAMDISK kernel and SYS_UBOOT into hp300 installcd to make it bootable.

This should finally close PR/54455.

Fix tools build errors on Cygwin.

Appease warnings on building tools/installboot on Cygwin.
 1.15 28-May-2025  tsutsui Bump bootloader versions to denote recent netboot and 362/382 sti changes.
 1.14 28-Apr-2020  tsutsui branches: 1.14.26;
Fix inappropriate error messages when nfs_mount() fails.

Noticed by Chris Hanson and his HP330 and confirmed on my HP425e.
Also bump revisions to denote visible changes.
Worth to pull up to netbsd-9.
 1.13 17-Jan-2016  tsutsui branches: 1.13.22;
Enable LIBSA_CREAD_NOCRC. PR/50638

Bump version to denote user visible change.
Tested on HP9000/382.
 1.12 26-Apr-2014  tsutsui branches: 1.12.4;
Bump versions to denote recent 425e related changes.
 1.11 12-Feb-2011  tsutsui branches: 1.11.4; 1.11.10; 1.11.14; 1.11.18; 1.11.28;
Bump version for 362 and 382 framebuffer support.
 1.10 10-Feb-2011  tsutsui Bump version to denote standalone ITE driver reorganization
pulled from OpenBSD.
 1.9 16-Jul-2008  tsutsui branches: 1.9.16; 1.9.22; 1.9.24;
Change boot messages to replace build date and maker with kernrev.
 1.8 20-Jul-2006  tsutsui branches: 1.8.58; 1.8.62; 1.8.64; 1.8.66; 1.8.68;
Identify models HP362 and HP382. From OpenBSD, tested on my HP382.

Note now options HP362 and options HP382 are required for these models
in your kernel config file.
 1.7 12-May-1997  thorpej branches: 1.7.72; 1.7.86; 1.7.90;
Bump version: Added APCI console support
 1.6 27-Apr-1997  thorpej Bump version: Better SPU detection code
 1.5 10-Mar-1997  thorpej Bump version - we compute the kernel load address differently.
 1.4 04-Feb-1997  thorpej branches: 1.4.4;
Bump version: Add support for reading gzip'd miniroot images
 1.3 04-Feb-1997  thorpej Bump version: Reorganization of boot block code
 1.2 04-Feb-1997  thorpej Replay history: Added support for HP-IB cartridge tapes
 1.1 04-Feb-1997  thorpej Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.4.4.1 11-Mar-1997  is merge in changes from Trunk.
 1.7.90.1 11-Aug-2006  yamt sync with head
 1.7.86.1 09-Sep-2006  rpaulo sync with head
 1.7.72.1 30-Dec-2006  yamt sync with head.
 1.8.68.1 19-Oct-2008  haad Sync with HEAD.
 1.8.66.1 18-Jul-2008  simonb Sync with head.
 1.8.64.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.8.62.1 04-May-2009  yamt sync with head.
 1.8.58.1 28-Sep-2008  mjf Sync with HEAD.
 1.9.24.1 17-Feb-2011  bouyer Sync with HEAD
 1.9.22.1 06-Jun-2011  jruoho Sync with HEAD.
 1.9.16.1 05-Mar-2011  rmind sync with head
 1.11.28.1 10-Aug-2014  tls Rebase.
 1.11.18.1 18-May-2014  rmind sync with head
 1.11.14.2 03-Dec-2017  jdolecek update from HEAD
 1.11.14.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.11.10.1 21-May-2014  bouyer Pull up following revision(s) (requested by tsutsui in ticket #1058):
sys/arch/hp300/conf/files.hp300: revision 1.88
sys/arch/hp300/include/autoconf.h: revision 1.13
sys/dev/ic/sti.c: revision 1.17
sys/arch/hp300/dev/frodo.c: revision 1.31
sys/arch/hp300/conf/GENERIC: revision 1.173
sys/arch/hp300/hp300/machdep.c: revision 1.229
sys/arch/hp300/dev/frodo.c: revision 1.32
sys/arch/hp300/hp300/autoconf.c: revision 1.102
sys/arch/hp300/dev/frodoreg.h: revision 1.5
sys/arch/hp300/stand/common/ite_sti.c: revision 1.1
sys/arch/hp300/stand/common/itevar.h: revision 1.16
sys/arch/hp300/hp300/autoconf.c: revision 1.105
sys/arch/hp300/dev/sti_sgcvar.h: revision 1.1
sys/arch/hp300/stand/common/apci.c: revision 1.12
sys/arch/hp300/stand/common/apci.c: revision 1.13
sys/arch/hp300/dev/dnkbd.c: revision 1.6
sys/arch/hp300/dev/dnkbd.c: revision 1.7
sys/arch/hp300/stand/inst/version: revision 1.12
sys/arch/hp300/dev/com_frodo.c: revision 1.9
sys/arch/hp300/stand/common/ite.c: revision 1.17
sys/arch/hp300/conf/GENERIC: revision 1.181
sys/arch/hp300/dev/sti_sgc.c: revision 1.1
sys/arch/hp300/stand/common/dnkbd.c: revision 1.13
sys/arch/hp300/dev/sti_sgc.c: revision 1.2
sys/dev/ic/stivar.h: revision 1.8
sys/arch/hp300/dev/rtc.c: revision 1.21
sys/arch/hp300/conf/INSTALL: revision 1.56
sys/arch/hp300/conf/INSTALL: revision 1.58
sys/arch/hp300/stand/uboot/version: revision 1.19
sys/arch/hp300/stand/common/samachdep.h: revision 1.17
sys/arch/hp300/stand/common/clock.c: revision 1.12
sys/arch/hp300/dev/mcclock_frodo.c: revision 1.1
sys/arch/hp300/stand/Makefile.buildboot: revision 1.34
sys/arch/hp300/conf/files.hp300: revision 1.87
Add sti at sgc framebuffer.
Ported from OpenBSD by kiyohara@.
Fix a botch on switching from apci (and dca) to MI com(4) 10 years ago.
I.e. fix apci device address per FRODO_BASE macro change
in frodoreg.h rev 1.2. Now bootloader works with serial console
on HP425e (which has only com at frodo).
Thanks to miod@openbsd for providing his 425e.
Add sti(4) at sgc screen console support. From (the late) OpenBSD/hp300.
Tested on HP9000/425e, which was sent from Miod Vallat and
demonstrated at Open Source unConference 2014 Kagawa.
Check the service switch on 425e to select apci serial console.
Taken from OpenBSD/hp300. See the following comment for details:
> * Check the service switch. On the 425e, this is a physical
> * switch, unlike other frodo-based machines, so we can use it
> * as a serial vs internal video selector, since the PROM can not
> * be configured for serial console.
Add proper RealTime Clock support for HP9000/425e.
As the OpenBSD/hp300 page says 425e doesn't have the traditional
RTC at intio (as it also lacks DCA 16550 serial at intio?),
but after a few hour investigation it turns out that
425e uses mc146818 compatible calendar clock in
the Apollo "frodo" utility chip and the frodo chip on
425e actually has the 32kHz OSC and is actually backed up
by the onboard lithium battery.
Tested on HP425e (with mcclock) and HP362 (with old rtc).
Add RTC support for HP9000/425e to bootloader too.
Also put several cleanup:
- make local functions and variables static
- use proper variable types
- some KNF
Note it turns out that extreme slowness of netboot on hp300 is
caused by the too slow access of the traditional RTC chip at intio
(i.e. netboot on 425e is so much faster than others). Oh well.
Add proper consinit(9) support for sti(4) at sgc framebuffer on hp300.
The cnattach functions for sti(4) and service switch check method
for 425e in com_frodo.c are taken from OpenBSD.
The strategy how to choose the console device in hp300_cninit() is
quite diverged from 4.4BSD and OpenBSD so it's tweaked by me.
Also put several changes in sti_sgc.c to reduce diffs from OpenBSD/hp300.
Tested on 425e and 362 (which still uses gendiofb(4), not sti(4)).
XXX: sti(4) requires uvm_km_alloc(9) and uvm_map_protect(9)
to copy and call ROM functions on the executable memory region, so
it can be called before UVM and related initializations are complete.
Probably it's time to consider about MI "deferred consinit()" API
in init_main.c (or elsewhere) for modern complicated VM system...
Also fix the apci device address in dnkbd.c as apci.c rev 1.12:
http://mail-index.netbsd.org/source-changes/2014/04/10/msg053940.html
Finally dnkbd(4) is confirmed working at least on bootloader.
Thanks again to Miod Vallat.
Make the Apollo Domain keyboard actually work.
Tested on HP9000/425e and the keyboard model A1630-82001 R2 (RX-60857-HW)
provided by Miod Vallat. Mouse support needs more work.
Pull random notes on the Apollo Domain keyboard from ancient PR/3528.
Bump versions to denote recent 425e related changes.
Probe mcclock only on 425e to avoid an extra "not configured" message.
Add and enable sti(4) at sgc in install kernels for 425e.
Tested on both serial console and framebuffer console.
(switched by the service switch on the back panel)
 1.11.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.12.4.1 19-Mar-2016  skrll Sync with HEAD
 1.13.22.1 01-May-2020  martin Pull up following revision(s) (requested by tsutsui in ticket #880):

sys/arch/hp300/stand/uboot/version: revision 1.21
sys/arch/hp300/stand/inst/version: revision 1.14
sys/arch/hp300/stand/common/netio.c: revision 1.17

Fix inappropriate error messages when nfs_mount() fails.

Noticed by Chris Hanson and his HP332 and confirmed on my HP425e.

Also bump revisions to denote visible changes.
Worth to pull up to netbsd-9.
 1.14.26.1 02-Aug-2025  perseant Sync with HEAD
 1.6 09-Feb-2002  lukem use ${INSTALL_FILE} as appropriate
 1.5 12-Dec-2001  tv MKfoo=no -> NOfoo
 1.4 08-Nov-2001  gmcgarry branches: 1.4.2;
Make install observe ${INSTPRIV}
 1.3 23-Sep-2000  simonb branches: 1.3.4; 1.3.6;
Use ${COPY} instead of -c for ${INSTALL} commands.
 1.2 13-Feb-1999  lukem branches: 1.2.8;
convert from NOxxx= to MKxxx=no.
include <bsd.own.mk> if testing a MKxxx variable.
 1.1 04-Feb-1997  thorpej Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.2.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.3.6.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.3.4.2 16-Mar-2002  jdolecek Catch up with -current.
 1.3.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.4.2.3 28-Feb-2002  nathanw Catch up to -current.
 1.4.2.2 08-Jan-2002  nathanw Catch up to -current.
 1.4.2.1 08-Nov-2001  nathanw file Makefile was added on branch nathanw_sa on 2002-01-08 00:24:47 +0000
 1.3 11-Dec-2005  christos merge ktrace-lwp.
 1.2 14-Jun-2005  dsl Change to use installboot - now it is being built for hp300.
 1.1 04-Feb-1997  thorpej branches: 1.1.60;
Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.1.60.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.13 24-Feb-2024  christos avoid stringop truncation, fix copyright string to prevent assembler warnings.
 1.12 20-Feb-2024  christos add missing chunk for repro-build. fix gcc warnings.
 1.11 11-Dec-2005  christos branches: 1.11.196;
merge ktrace-lwp.
 1.10 28-Nov-2004  jmc Convert mkboot into a full cross tool. Last hurdle for hp300 to building on
non NetBSD/bsd hosts.
 1.9 23-Oct-2002  lukem branches: 1.9.6; 1.9.10;
this is a HOSTPROG; no need to set LDSTATIC=-static
 1.8 27-Aug-2002  lukem arch/*/stand stuff should be LDSTATIC=-static and not LDSTATIC?=-static.
It doesn't make sense to have standalone stuff dynamically linked just
because an end-user uses LDSTATIC="".
 1.7 12-Dec-2001  tv branches: 1.7.8;
MKfoo=no -> NOfoo
 1.6 27-May-2001  gmcgarry branches: 1.6.2; 1.6.8;
- remove dependency on libsa by mkboot since it is a host tool.
- adjust for endianness of host.

Cross-compiling of ELF bootblocks now works.
 1.5 02-Jan-2001  simonb branches: 1.5.2;
Convert both bootblocks and mkboot to use libsa's loadfile(), and make
both ELF aware.
 1.4 13-Feb-1999  lukem branches: 1.4.2; 1.4.8;
convert from NOxxx= to MKxxx=no.
include <bsd.own.mk> if testing a MKxxx variable.
 1.3 02-Mar-1998  cgd allow LDSTATIC definition to be overridden by bsd.own.mk/mk.conf
 1.2 14-May-1997  thorpej Link this program statically.
 1.1 04-Feb-1997  thorpej Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.4.8.1 05-Jan-2001  bouyer Sync with HEAD
 1.4.2.1 25-Sep-2000  he Apply patch (requested by he):
Fix build problem during ``make release'', caused by missing
just-cleaned executable in the release phase.
 1.5.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.6.8.4 11-Nov-2002  nathanw Catch up to -current
 1.6.8.3 27-Aug-2002  nathanw Catch up to -current.
 1.6.8.2 08-Jan-2002  nathanw Catch up to -current.
 1.6.8.1 27-May-2001  nathanw file Makefile was added on branch nathanw_sa on 2002-01-08 00:24:48 +0000
 1.6.2.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.6.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.7.8.1 30-Aug-2002  gehenna catch up with -current.
 1.9.10.1 02-Apr-2005  he Pull up revision 1.10 (requested by jmc in ticket #1025):
Convert mkboot into a full cross tool. Last hurdle for hp300 to
building on non NetBSD/bsd hosts.
 1.9.6.1 29-Nov-2004  skrll Sync with HEAD.
 1.11.196.1 22-Jun-2024  martin Pull up following revision(s) (requested by tsutsui in ticket #722):

sys/fs/cd9660/cd9660_util.c: revision 1.16
sys/arch/hp300/stand/common/clock.c: revision 1.14
sys/arch/hp300/stand/common/scsireg.h: revision 1.5
sys/arch/hp300/stand/common/scsireg.h: revision 1.6
sys/arch/hp300/stand/Makefile.buildboot: revision 1.38
sys/arch/hp300/include/bus.h: revision 1.23
sys/arch/hp300/stand/Makefile.buildboot: revision 1.39
sys/arch/hp300/stand/common/sd.c: revision 1.12
sys/arch/hp300/stand/common/prf.c: revision 1.6
sys/arch/hp300/stand/common/sd.c: revision 1.13
usr.sbin/installboot/installboot.8: revision 1.106
usr.sbin/installboot/Makefile: revision 1.59
sys/arch/hp300/stand/common/devopen.c: revision 1.14
usr.sbin/installboot/installboot.8: revision 1.107
sys/arch/hp300/stand/common/ite_dumb.c: revision 1.2
sys/arch/hp300/stand/common/devopen.c: revision 1.15
usr.sbin/installboot/installboot.8: revision 1.108
sys/fs/cd9660/cd9660_extern.h: revision 1.29
usr.sbin/installboot/installboot.8: revision 1.109
tools/Makefile.nbincludes: revision 1.11 (patch)
sys/arch/hp300/dev/rboxreg.h: revision 1.3
sys/arch/hp300/stand/common/scsivar.h: revision 1.5
sys/arch/hp300/dev/dnkbd.c: revision 1.14
sys/arch/hp300/hp300/trap.c: revision 1.156
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.12
sys/arch/hp300/dev/frodoreg.h: revision 1.6
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.13
sys/arch/hp300/stand/common/ite_sti.c: revision 1.2
sys/arch/hp300/stand/common/hil.c: revision 1.15
usr.sbin/installboot/arch/hp300.c: revision 1.18
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.14
sys/arch/hp300/dev/rbox.c: revision 1.4
usr.sbin/installboot/arch/hp300.c: revision 1.19
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.15
sys/sys/bootblock.h: revision 1.59
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.16
usr.sbin/installboot/installboot.h: revision 1.44
sys/arch/hp300/stand/mkboot/volhdr.h: file removal
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.17
sys/arch/hp300/dev/hpib.c: revision 1.45
usr.sbin/installboot/installboot.h: revision 1.45
usr.sbin/installboot/cd9660.c: revision 1.1
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.18
sys/arch/hp300/dev/topcatreg.h: revision 1.3
usr.sbin/installboot/cd9660.c: revision 1.2
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.19
sys/arch/hp300/stand/inst/inst.c: revision 1.25
sys/arch/hp300/stand/uboot/Makefile: revision 1.12
sys/arch/hp300/dev/dvbox.c: revision 1.4
sys/arch/hp300/dev/dma.c: revision 1.45
sys/arch/hp300/stand/uboot/Makefile: revision 1.13
sys/arch/hp300/stand/common/rd.c: revision 1.16
sys/arch/hp300/stand/inst/Makefile: revision 1.12
distrib/hp300/cdroms/installcd/Makefile: revision 1.4
sys/arch/hp300/stand/mkboot/volhdr.h: revision 1.6
sys/arch/hp300/stand/common/machdep.c: revision 1.16
usr.sbin/installboot/fstypes.c: revision 1.14
sys/arch/hp300/hp300/machdep.c: revision 1.238
sys/arch/hp300/include/cpu.h: revision 1.73
sys/arch/hp300/dev/diofbreg.h: revision 1.4
sys/arch/hp300/stand/common/scsi.c: revision 1.12
sys/arch/hp300/stand/common/netio.c: revision 1.19
sys/arch/hp300/stand/common/scsi.c: revision 1.13
sys/arch/hp300/dev/sti_sgc.c: revision 1.8
sys/arch/hp300/dev/rtc.c: revision 1.22
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.20
sys/arch/hp300/stand/common/conf.h: revision 1.4
sys/arch/hp300/hp300/autoconf.c: revision 1.111
sys/arch/hp300/stand/common/conf.c: revision 1.15
sys/arch/hp300/stand/mkboot/Makefile: revision 1.12
sys/arch/hp300/stand/mkboot/Makefile: revision 1.13
sys/arch/hp300/hp300/autoconf.c: revision 1.114
sys/arch/hp300/dev/dcmreg.h: revision 1.11
sys/arch/hp300/dev/diofbvar.h: revision 1.4
sys/arch/hp300/dev/dcm.c: revision 1.91
sys/fs/cd9660/cd9660_util.c: revision 1.15
sys/arch/hp300/dev/mcclock_frodo.c: revision 1.2

TAB/space cleanup.

installboot(8): formatting improvements

Use Ar foo instead of <foo>; this is mdoc.

Other formatting tweaks.
installboot(8): fix up markup

Don't overuse .Sy - when everything is highlighted, nothing is. Use
.Ic for options &c to get correct PostScript output (both are bold in
plain text).

Use Aq Ar inside .Pa, as both Pa and Ar are rendered as underscored
text in plain text output, and the distinction is lost.

Don't set examples in bold, but give them .Pp space around - they are
much easier to read this way.

Use consistent -width in FILES.
document how to use installboot on netbsd/vax.

PR/57909: Jan-Benedict Glaw: Don't include (build) timestamp when doing a
reproducible build
fix usage string, improve error handling.
add missing chunk for repro-build. fix gcc warnings.
avoid stringop truncation, fix copyright string to prevent assembler warnings.

Fix build as a tool (Jan-Benedict Glaw)

Fix integer overflow of strtol(3) for "loadpoint" address on ILP32 hosts.

This strtol(3) was introduced in rev 1.12 for PR/57909 after netbsd-10,
but it returns LONG_MAX (0x7FFFFFFF) for 0xFFF00000 on ILP32 hosts and
the wrong loadpoint causes "NOT ENOUGH MEMORY" error by the BOOTROMs
on loading uboot.lif on (at least) my 9000/360 and 9000/425t.

Misc cosmetic changes for mostly readability.
- KNF and add some newlines per blocks
- define and use proper bintobcd() macro
- make local functions and variables static

The same uboot.lif binaries are generated.

Rename ${PROGAOUT} -> ${PROGELF} to reflect reality.
Use proper signedness for the LIF file system data structures.

Ancient 4.3BSD used short and int for location, file size, file type,
and addresses etc. but all of them should be unsigned.

Also rename several variables and add comments for readability.
The LIF file system info can be found in "The HPDir Project" page:
https://www.hp9845.net/9845/projects/hpdir/
The same uboot.lif binaries are generated.

Add a preliminary CD boot support to uboot for preparation of PR/54455.
Briefly tested on mame, but not enalbed yet.

Recognize SCSI CD-ROM devices as a booted device properly.

Necessary for PR port-hp300/54455, to boot an md root root RAMDISK

kernel from CD-ROM without "WARNING: can't find match for bootdev:"
prompt.

Sync with src/sys/arch/hp300/stand/mkboot/volhdr.h rev 1.6.
https://mail-index.netbsd.org/source-changes/2024/05/07/msg151195.html

Use proper signedness for the LIF file system data structures.
mkboot should use this MI <sys/bootblock.h> and volhdr.h should
be removed soon.

Use MI <sys/bootblock.h> to refer LIF filesystem structures.
This should have been done when LIF definitions were initially added
to <sys/bootblock.h> for MI installboot(8).

Enable SUPPORT_CD on uboot.

Make cd9660_util.c usable in userland tools like installboot(8).

This was partially done for src/distrib/cdrom/macppc_installboot,
but more strict prototypes are necessary for native binary builds.

Install cd9660 related system headers for tools installboot(8) builds.

Reorder function prototypes per source files.

Add cd9660 support to search a bootloader file in the target file system.

Also add CD boot support for hp300, using a bootloader file in cd9660 fs.
This is a tool's part to close PR/54455.

HP 9000/300 machines read LIF directory entry allocated after
the LIF volume header at the top of the boot disk during bootstrap,
and a bootstrap file must be contiguously allocated on the disk
due to limitation of the LIF specification.

Current NetBSD/hp300's bootloader is larger than ~80KB so we have
to prepare a special 'boot' partition for FFS (that has only 8KB (ffsv1)
or 32KB (ffsv2) spaces) disks to put such a large bootloader.

On the other hand, on ISO9660 fs all files are allocated contiguously
so we can specify a bootloader file in the target ISO9660 directly
in the LIF directory entry.

Note we can simply use the existing "append" option to create bootable
CD ISO for hp300, but it looks some emulators (at leaset MAME) reject
such non-standard ISO files, i.e. with an appended bootloader file at
the end of the image.

Put a RAMDISK kernel and SYS_UBOOT into hp300 installcd to make it bootable.

This should finally close PR/54455.

Fix tools build errors on Cygwin.

Appease warnings on building tools/installboot on Cygwin.
 1.21 05-Apr-2025  tsutsui Cleanup hp300 LIF bootblock definitions.

- move LIF value definitions from MD mkboot to MI <sys/bootblock.h>
to share them between mkboot and MI installboot(8)
- rename variables and use proper macros for readability
- misc KNF
 1.20 11-May-2024  tsutsui branches: 1.20.2;
Use MI <sys/bootblock.h> to refer LIF filesystem structures.

This should have been done when LIF definitions were initially added
to <sys/bootblock.h> for MI installboot(8).
 1.19 07-May-2024  tsutsui Use proper signedness for the LIF file system data structures.

Ancient 4.3BSD used short and int for location, file size, file type,
and addresses etc. but all of them should be unsigned.
Also rename several variables and add comments for readability.

The LIF file system info can be found in "The HPDir Project" page:
https://www.hp9845.net/9845/projects/hpdir/

The same uboot.lif binaries are generated.
 1.18 06-May-2024  tsutsui Misc cosmetic changes for mostly readability.

- KNF and add some newlines per blocks
- define and use proper bintobcd() macro
- make local functions and variables static

The same uboot.lif binaries are generated.
 1.17 05-May-2024  tsutsui Fix integer overflow of strtol(3) for "loadpoint" address on ILP32 hosts.

This strtol(3) was introduced in rev 1.12 for PR/57909 after netbsd-10,
but it returns LONG_MAX (0x7FFFFFFF) for 0xFFF00000 on ILP32 hosts and
the wrong loadpoint causes "NOT ENOUGH MEMORY" error by the BOOTROMs
on loading uboot.lif on (at least) my 9000/360 and 9000/425t.
 1.16 03-May-2024  christos Fix build as a tool (Jan-Benedict Glaw)
 1.15 24-Feb-2024  christos avoid stringop truncation, fix copyright string to prevent assembler warnings.
 1.14 20-Feb-2024  christos add missing chunk for repro-build. fix gcc warnings.
 1.13 09-Feb-2024  christos fix usage string, improve error handling.
 1.12 08-Feb-2024  christos PR/57909: Jan-Benedict Glaw: Don't include (build) timestamp when doing a
reproducible build
 1.11 11-Oct-2014  dholland branches: 1.11.50;
PR 49245: Fix broken RCSID (Kamil Rytarowski)
 1.10 18-Jun-2006  gdamore branches: 1.10.106;
Fix to make this cross compile on Solaris. (Don't include sys/endian.h
if HAVE_NBTOOL_CONFIG_H is defined.)
 1.9 11-Dec-2005  christos branches: 1.9.4; 1.9.8; 1.9.14; 1.9.16;
merge ktrace-lwp.
 1.8 20-Feb-2005  tsutsui branches: 1.8.4;
Use ANSI function decls.
 1.7 28-Nov-2004  jmc branches: 1.7.4; 1.7.6;
Convert mkboot into a full cross tool. Last hurdle for hp300 to building on
non NetBSD/bsd hosts.
 1.6 13-Nov-2003  tsutsui branches: 1.6.4;
Don't use htobe32() for int16_t values.
 1.5 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.4 05-Mar-2002  simonb branches: 1.4.14;
Indent by tab and not two spaces.
 1.3 27-May-2001  gmcgarry branches: 1.3.2; 1.3.8;
- remove dependency on libsa by mkboot since it is a host tool.
- adjust for endianness of host.

Cross-compiling of ELF bootblocks now works.
 1.2 02-Jan-2001  simonb branches: 1.2.2;
Convert both bootblocks and mkboot to use libsa's loadfile(), and make
both ELF aware.
 1.1 04-Feb-1997  thorpej branches: 1.1.26;
Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.1.26.1 05-Jan-2001  bouyer Sync with HEAD
 1.2.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.3.8.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.3.8.1 27-May-2001  nathanw file mkboot.c was added on branch nathanw_sa on 2002-04-01 07:40:00 +0000
 1.3.2.1 16-Mar-2002  jdolecek Catch up with -current.
 1.4.14.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.4.14.4 29-Nov-2004  skrll Sync with HEAD.
 1.4.14.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.14.2 18-Sep-2004  skrll Sync with HEAD.
 1.4.14.1 03-Aug-2004  skrll Sync with HEAD
 1.6.4.1 02-Apr-2005  he Pull up revision 1.7 (requested by jmc in ticket #1025):
Convert mkboot into a full cross tool. Last hurdle for hp300 to
building on non NetBSD/bsd hosts.
 1.7.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.7.4.1 29-Apr-2005  kent sync with -current
 1.8.4.1 21-Jun-2006  yamt sync with head.
 1.9.16.1 18-Jun-2006  gdamore Fix to make this cross compile on Solaris. (Don't include sys/endian.h
if HAVE_NBTOOL_CONFIG_H is defined.)
 1.9.14.1 19-Jun-2006  chap Sync with head.
 1.9.8.1 26-Jun-2006  yamt sync with head.
 1.9.4.1 09-Sep-2006  rpaulo sync with head
 1.10.106.1 03-Dec-2017  jdolecek update from HEAD
 1.11.50.1 22-Jun-2024  martin Pull up following revision(s) (requested by tsutsui in ticket #722):

sys/fs/cd9660/cd9660_util.c: revision 1.16
sys/arch/hp300/stand/common/clock.c: revision 1.14
sys/arch/hp300/stand/common/scsireg.h: revision 1.5
sys/arch/hp300/stand/common/scsireg.h: revision 1.6
sys/arch/hp300/stand/Makefile.buildboot: revision 1.38
sys/arch/hp300/include/bus.h: revision 1.23
sys/arch/hp300/stand/Makefile.buildboot: revision 1.39
sys/arch/hp300/stand/common/sd.c: revision 1.12
sys/arch/hp300/stand/common/prf.c: revision 1.6
sys/arch/hp300/stand/common/sd.c: revision 1.13
usr.sbin/installboot/installboot.8: revision 1.106
usr.sbin/installboot/Makefile: revision 1.59
sys/arch/hp300/stand/common/devopen.c: revision 1.14
usr.sbin/installboot/installboot.8: revision 1.107
sys/arch/hp300/stand/common/ite_dumb.c: revision 1.2
sys/arch/hp300/stand/common/devopen.c: revision 1.15
usr.sbin/installboot/installboot.8: revision 1.108
sys/fs/cd9660/cd9660_extern.h: revision 1.29
usr.sbin/installboot/installboot.8: revision 1.109
tools/Makefile.nbincludes: revision 1.11 (patch)
sys/arch/hp300/dev/rboxreg.h: revision 1.3
sys/arch/hp300/stand/common/scsivar.h: revision 1.5
sys/arch/hp300/dev/dnkbd.c: revision 1.14
sys/arch/hp300/hp300/trap.c: revision 1.156
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.12
sys/arch/hp300/dev/frodoreg.h: revision 1.6
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.13
sys/arch/hp300/stand/common/ite_sti.c: revision 1.2
sys/arch/hp300/stand/common/hil.c: revision 1.15
usr.sbin/installboot/arch/hp300.c: revision 1.18
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.14
sys/arch/hp300/dev/rbox.c: revision 1.4
usr.sbin/installboot/arch/hp300.c: revision 1.19
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.15
sys/sys/bootblock.h: revision 1.59
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.16
usr.sbin/installboot/installboot.h: revision 1.44
sys/arch/hp300/stand/mkboot/volhdr.h: file removal
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.17
sys/arch/hp300/dev/hpib.c: revision 1.45
usr.sbin/installboot/installboot.h: revision 1.45
usr.sbin/installboot/cd9660.c: revision 1.1
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.18
sys/arch/hp300/dev/topcatreg.h: revision 1.3
usr.sbin/installboot/cd9660.c: revision 1.2
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.19
sys/arch/hp300/stand/inst/inst.c: revision 1.25
sys/arch/hp300/stand/uboot/Makefile: revision 1.12
sys/arch/hp300/dev/dvbox.c: revision 1.4
sys/arch/hp300/dev/dma.c: revision 1.45
sys/arch/hp300/stand/uboot/Makefile: revision 1.13
sys/arch/hp300/stand/common/rd.c: revision 1.16
sys/arch/hp300/stand/inst/Makefile: revision 1.12
distrib/hp300/cdroms/installcd/Makefile: revision 1.4
sys/arch/hp300/stand/mkboot/volhdr.h: revision 1.6
sys/arch/hp300/stand/common/machdep.c: revision 1.16
usr.sbin/installboot/fstypes.c: revision 1.14
sys/arch/hp300/hp300/machdep.c: revision 1.238
sys/arch/hp300/include/cpu.h: revision 1.73
sys/arch/hp300/dev/diofbreg.h: revision 1.4
sys/arch/hp300/stand/common/scsi.c: revision 1.12
sys/arch/hp300/stand/common/netio.c: revision 1.19
sys/arch/hp300/stand/common/scsi.c: revision 1.13
sys/arch/hp300/dev/sti_sgc.c: revision 1.8
sys/arch/hp300/dev/rtc.c: revision 1.22
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.20
sys/arch/hp300/stand/common/conf.h: revision 1.4
sys/arch/hp300/hp300/autoconf.c: revision 1.111
sys/arch/hp300/stand/common/conf.c: revision 1.15
sys/arch/hp300/stand/mkboot/Makefile: revision 1.12
sys/arch/hp300/stand/mkboot/Makefile: revision 1.13
sys/arch/hp300/hp300/autoconf.c: revision 1.114
sys/arch/hp300/dev/dcmreg.h: revision 1.11
sys/arch/hp300/dev/diofbvar.h: revision 1.4
sys/arch/hp300/dev/dcm.c: revision 1.91
sys/fs/cd9660/cd9660_util.c: revision 1.15
sys/arch/hp300/dev/mcclock_frodo.c: revision 1.2

TAB/space cleanup.

installboot(8): formatting improvements

Use Ar foo instead of <foo>; this is mdoc.

Other formatting tweaks.
installboot(8): fix up markup

Don't overuse .Sy - when everything is highlighted, nothing is. Use
.Ic for options &c to get correct PostScript output (both are bold in
plain text).

Use Aq Ar inside .Pa, as both Pa and Ar are rendered as underscored
text in plain text output, and the distinction is lost.

Don't set examples in bold, but give them .Pp space around - they are
much easier to read this way.

Use consistent -width in FILES.
document how to use installboot on netbsd/vax.

PR/57909: Jan-Benedict Glaw: Don't include (build) timestamp when doing a
reproducible build
fix usage string, improve error handling.
add missing chunk for repro-build. fix gcc warnings.
avoid stringop truncation, fix copyright string to prevent assembler warnings.

Fix build as a tool (Jan-Benedict Glaw)

Fix integer overflow of strtol(3) for "loadpoint" address on ILP32 hosts.

This strtol(3) was introduced in rev 1.12 for PR/57909 after netbsd-10,
but it returns LONG_MAX (0x7FFFFFFF) for 0xFFF00000 on ILP32 hosts and
the wrong loadpoint causes "NOT ENOUGH MEMORY" error by the BOOTROMs
on loading uboot.lif on (at least) my 9000/360 and 9000/425t.

Misc cosmetic changes for mostly readability.
- KNF and add some newlines per blocks
- define and use proper bintobcd() macro
- make local functions and variables static

The same uboot.lif binaries are generated.

Rename ${PROGAOUT} -> ${PROGELF} to reflect reality.
Use proper signedness for the LIF file system data structures.

Ancient 4.3BSD used short and int for location, file size, file type,
and addresses etc. but all of them should be unsigned.

Also rename several variables and add comments for readability.
The LIF file system info can be found in "The HPDir Project" page:
https://www.hp9845.net/9845/projects/hpdir/
The same uboot.lif binaries are generated.

Add a preliminary CD boot support to uboot for preparation of PR/54455.
Briefly tested on mame, but not enalbed yet.

Recognize SCSI CD-ROM devices as a booted device properly.

Necessary for PR port-hp300/54455, to boot an md root root RAMDISK

kernel from CD-ROM without "WARNING: can't find match for bootdev:"
prompt.

Sync with src/sys/arch/hp300/stand/mkboot/volhdr.h rev 1.6.
https://mail-index.netbsd.org/source-changes/2024/05/07/msg151195.html

Use proper signedness for the LIF file system data structures.
mkboot should use this MI <sys/bootblock.h> and volhdr.h should
be removed soon.

Use MI <sys/bootblock.h> to refer LIF filesystem structures.
This should have been done when LIF definitions were initially added
to <sys/bootblock.h> for MI installboot(8).

Enable SUPPORT_CD on uboot.

Make cd9660_util.c usable in userland tools like installboot(8).

This was partially done for src/distrib/cdrom/macppc_installboot,
but more strict prototypes are necessary for native binary builds.

Install cd9660 related system headers for tools installboot(8) builds.

Reorder function prototypes per source files.

Add cd9660 support to search a bootloader file in the target file system.

Also add CD boot support for hp300, using a bootloader file in cd9660 fs.
This is a tool's part to close PR/54455.

HP 9000/300 machines read LIF directory entry allocated after
the LIF volume header at the top of the boot disk during bootstrap,
and a bootstrap file must be contiguously allocated on the disk
due to limitation of the LIF specification.

Current NetBSD/hp300's bootloader is larger than ~80KB so we have
to prepare a special 'boot' partition for FFS (that has only 8KB (ffsv1)
or 32KB (ffsv2) spaces) disks to put such a large bootloader.

On the other hand, on ISO9660 fs all files are allocated contiguously
so we can specify a bootloader file in the target ISO9660 directly
in the LIF directory entry.

Note we can simply use the existing "append" option to create bootable
CD ISO for hp300, but it looks some emulators (at leaset MAME) reject
such non-standard ISO files, i.e. with an appended bootloader file at
the end of the image.

Put a RAMDISK kernel and SYS_UBOOT into hp300 installcd to make it bootable.

This should finally close PR/54455.

Fix tools build errors on Cygwin.

Appease warnings on building tools/installboot on Cygwin.
 1.20.2.1 02-Aug-2025  perseant Sync with HEAD
 1.7 11-May-2024  tsutsui Use MI <sys/bootblock.h> to refer LIF filesystem structures.

This should have been done when LIF definitions were initially added
to <sys/bootblock.h> for MI installboot(8).
 1.6 07-May-2024  tsutsui Use proper signedness for the LIF file system data structures.

Ancient 4.3BSD used short and int for location, file size, file type,
and addresses etc. but all of them should be unsigned.
Also rename several variables and add comments for readability.

The LIF file system info can be found in "The HPDir Project" page:
https://www.hp9845.net/9845/projects/hpdir/

The same uboot.lif binaries are generated.
 1.5 08-Feb-2011  rmind branches: 1.5.86;
Remove clause 3 (UCB advertising clause) from the University of Utah
copyright. Confirmed by Mike Hibler, mike at cs.utah.edu - thanks!
Also, merge UCB and Utah copyright texts back into one, as they
originally were.

Extra verification by snj@.
 1.4 11-Dec-2005  christos branches: 1.4.100; 1.4.106; 1.4.108;
merge ktrace-lwp.
 1.3 13-Nov-2003  tsutsui Use int16_t and int32_t rather than short and int.
 1.2 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.1 04-Feb-1997  thorpej branches: 1.1.60;
Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.1.60.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.60.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.60.1 03-Aug-2004  skrll Sync with HEAD
 1.4.108.1 17-Feb-2011  bouyer Sync with HEAD
 1.4.106.1 06-Jun-2011  jruoho Sync with HEAD.
 1.4.100.1 05-Mar-2011  rmind sync with head
 1.5.86.1 22-Jun-2024  martin Pull up following revision(s) (requested by tsutsui in ticket #722):

sys/fs/cd9660/cd9660_util.c: revision 1.16
sys/arch/hp300/stand/common/clock.c: revision 1.14
sys/arch/hp300/stand/common/scsireg.h: revision 1.5
sys/arch/hp300/stand/common/scsireg.h: revision 1.6
sys/arch/hp300/stand/Makefile.buildboot: revision 1.38
sys/arch/hp300/include/bus.h: revision 1.23
sys/arch/hp300/stand/Makefile.buildboot: revision 1.39
sys/arch/hp300/stand/common/sd.c: revision 1.12
sys/arch/hp300/stand/common/prf.c: revision 1.6
sys/arch/hp300/stand/common/sd.c: revision 1.13
usr.sbin/installboot/installboot.8: revision 1.106
usr.sbin/installboot/Makefile: revision 1.59
sys/arch/hp300/stand/common/devopen.c: revision 1.14
usr.sbin/installboot/installboot.8: revision 1.107
sys/arch/hp300/stand/common/ite_dumb.c: revision 1.2
sys/arch/hp300/stand/common/devopen.c: revision 1.15
usr.sbin/installboot/installboot.8: revision 1.108
sys/fs/cd9660/cd9660_extern.h: revision 1.29
usr.sbin/installboot/installboot.8: revision 1.109
tools/Makefile.nbincludes: revision 1.11 (patch)
sys/arch/hp300/dev/rboxreg.h: revision 1.3
sys/arch/hp300/stand/common/scsivar.h: revision 1.5
sys/arch/hp300/dev/dnkbd.c: revision 1.14
sys/arch/hp300/hp300/trap.c: revision 1.156
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.12
sys/arch/hp300/dev/frodoreg.h: revision 1.6
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.13
sys/arch/hp300/stand/common/ite_sti.c: revision 1.2
sys/arch/hp300/stand/common/hil.c: revision 1.15
usr.sbin/installboot/arch/hp300.c: revision 1.18
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.14
sys/arch/hp300/dev/rbox.c: revision 1.4
usr.sbin/installboot/arch/hp300.c: revision 1.19
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.15
sys/sys/bootblock.h: revision 1.59
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.16
usr.sbin/installboot/installboot.h: revision 1.44
sys/arch/hp300/stand/mkboot/volhdr.h: file removal
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.17
sys/arch/hp300/dev/hpib.c: revision 1.45
usr.sbin/installboot/installboot.h: revision 1.45
usr.sbin/installboot/cd9660.c: revision 1.1
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.18
sys/arch/hp300/dev/topcatreg.h: revision 1.3
usr.sbin/installboot/cd9660.c: revision 1.2
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.19
sys/arch/hp300/stand/inst/inst.c: revision 1.25
sys/arch/hp300/stand/uboot/Makefile: revision 1.12
sys/arch/hp300/dev/dvbox.c: revision 1.4
sys/arch/hp300/dev/dma.c: revision 1.45
sys/arch/hp300/stand/uboot/Makefile: revision 1.13
sys/arch/hp300/stand/common/rd.c: revision 1.16
sys/arch/hp300/stand/inst/Makefile: revision 1.12
distrib/hp300/cdroms/installcd/Makefile: revision 1.4
sys/arch/hp300/stand/mkboot/volhdr.h: revision 1.6
sys/arch/hp300/stand/common/machdep.c: revision 1.16
usr.sbin/installboot/fstypes.c: revision 1.14
sys/arch/hp300/hp300/machdep.c: revision 1.238
sys/arch/hp300/include/cpu.h: revision 1.73
sys/arch/hp300/dev/diofbreg.h: revision 1.4
sys/arch/hp300/stand/common/scsi.c: revision 1.12
sys/arch/hp300/stand/common/netio.c: revision 1.19
sys/arch/hp300/stand/common/scsi.c: revision 1.13
sys/arch/hp300/dev/sti_sgc.c: revision 1.8
sys/arch/hp300/dev/rtc.c: revision 1.22
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.20
sys/arch/hp300/stand/common/conf.h: revision 1.4
sys/arch/hp300/hp300/autoconf.c: revision 1.111
sys/arch/hp300/stand/common/conf.c: revision 1.15
sys/arch/hp300/stand/mkboot/Makefile: revision 1.12
sys/arch/hp300/stand/mkboot/Makefile: revision 1.13
sys/arch/hp300/hp300/autoconf.c: revision 1.114
sys/arch/hp300/dev/dcmreg.h: revision 1.11
sys/arch/hp300/dev/diofbvar.h: revision 1.4
sys/arch/hp300/dev/dcm.c: revision 1.91
sys/fs/cd9660/cd9660_util.c: revision 1.15
sys/arch/hp300/dev/mcclock_frodo.c: revision 1.2

TAB/space cleanup.

installboot(8): formatting improvements

Use Ar foo instead of <foo>; this is mdoc.

Other formatting tweaks.
installboot(8): fix up markup

Don't overuse .Sy - when everything is highlighted, nothing is. Use
.Ic for options &c to get correct PostScript output (both are bold in
plain text).

Use Aq Ar inside .Pa, as both Pa and Ar are rendered as underscored
text in plain text output, and the distinction is lost.

Don't set examples in bold, but give them .Pp space around - they are
much easier to read this way.

Use consistent -width in FILES.
document how to use installboot on netbsd/vax.

PR/57909: Jan-Benedict Glaw: Don't include (build) timestamp when doing a
reproducible build
fix usage string, improve error handling.
add missing chunk for repro-build. fix gcc warnings.
avoid stringop truncation, fix copyright string to prevent assembler warnings.

Fix build as a tool (Jan-Benedict Glaw)

Fix integer overflow of strtol(3) for "loadpoint" address on ILP32 hosts.

This strtol(3) was introduced in rev 1.12 for PR/57909 after netbsd-10,
but it returns LONG_MAX (0x7FFFFFFF) for 0xFFF00000 on ILP32 hosts and
the wrong loadpoint causes "NOT ENOUGH MEMORY" error by the BOOTROMs
on loading uboot.lif on (at least) my 9000/360 and 9000/425t.

Misc cosmetic changes for mostly readability.
- KNF and add some newlines per blocks
- define and use proper bintobcd() macro
- make local functions and variables static

The same uboot.lif binaries are generated.

Rename ${PROGAOUT} -> ${PROGELF} to reflect reality.
Use proper signedness for the LIF file system data structures.

Ancient 4.3BSD used short and int for location, file size, file type,
and addresses etc. but all of them should be unsigned.

Also rename several variables and add comments for readability.
The LIF file system info can be found in "The HPDir Project" page:
https://www.hp9845.net/9845/projects/hpdir/
The same uboot.lif binaries are generated.

Add a preliminary CD boot support to uboot for preparation of PR/54455.
Briefly tested on mame, but not enalbed yet.

Recognize SCSI CD-ROM devices as a booted device properly.

Necessary for PR port-hp300/54455, to boot an md root root RAMDISK

kernel from CD-ROM without "WARNING: can't find match for bootdev:"
prompt.

Sync with src/sys/arch/hp300/stand/mkboot/volhdr.h rev 1.6.
https://mail-index.netbsd.org/source-changes/2024/05/07/msg151195.html

Use proper signedness for the LIF file system data structures.
mkboot should use this MI <sys/bootblock.h> and volhdr.h should
be removed soon.

Use MI <sys/bootblock.h> to refer LIF filesystem structures.
This should have been done when LIF definitions were initially added
to <sys/bootblock.h> for MI installboot(8).

Enable SUPPORT_CD on uboot.

Make cd9660_util.c usable in userland tools like installboot(8).

This was partially done for src/distrib/cdrom/macppc_installboot,
but more strict prototypes are necessary for native binary builds.

Install cd9660 related system headers for tools installboot(8) builds.

Reorder function prototypes per source files.

Add cd9660 support to search a bootloader file in the target file system.

Also add CD boot support for hp300, using a bootloader file in cd9660 fs.
This is a tool's part to close PR/54455.

HP 9000/300 machines read LIF directory entry allocated after
the LIF volume header at the top of the boot disk during bootstrap,
and a bootstrap file must be contiguously allocated on the disk
due to limitation of the LIF specification.

Current NetBSD/hp300's bootloader is larger than ~80KB so we have
to prepare a special 'boot' partition for FFS (that has only 8KB (ffsv1)
or 32KB (ffsv2) spaces) disks to put such a large bootloader.

On the other hand, on ISO9660 fs all files are allocated contiguously
so we can specify a bootloader file in the target ISO9660 directly
in the LIF directory entry.

Note we can simply use the existing "append" option to create bootable
CD ISO for hp300, but it looks some emulators (at leaset MAME) reject
such non-standard ISO files, i.e. with an appended bootloader file at
the end of the image.

Put a RAMDISK kernel and SYS_UBOOT into hp300 installcd to make it bootable.

This should finally close PR/54455.

Fix tools build errors on Cygwin.

Appease warnings on building tools/installboot on Cygwin.
 1.13 19-May-2024  tsutsui Enable SUPPORT_CD on uboot.
 1.12 07-May-2024  tsutsui Rename ${PROGAOUT} -> ${PROGELF} to reflect reality.
 1.11 29-Apr-2024  tsutsui Use LINKS to create hard links to generate proper METALOG files.

Also use the default ${PROG} variable and "install" target.

Fixes PR port-hp300/58211.
Should be pulled up to netbsd-10 and netbsd-9.
 1.10 11-Dec-2022  tsutsui branches: 1.10.2;
Enable UFS2 support.

Tested on 425t with HPDisk emulating 7958B using NetBSD 9.3 UFS2 image.
 1.9 23-Sep-2019  christos Consistently use ${RELEASEDIR}/${RELEASEMACHINE} instead of
${RELEASEDIR}/${MACHINE} (Paul Ripke)
 1.8 03-Jan-2003  lukem branches: 1.8.194; 1.8.198;
Install release files under "${RELEASEDIR}/${MACHINE}/..." instead of
"${RELEASEDIR}/...".

${RELEASEDIR} is never cleaned , and ${RELEASEDIR}/${MACHINE} is only
cleaned if UPDATE is not defined.
 1.7 09-Feb-2002  lukem use ${INSTALL_FILE} as appropriate
 1.6 14-Dec-2001  gmcgarry include Makefile.buildboot before testing for RELEASEDIR
 1.5 08-Nov-2001  gmcgarry branches: 1.5.2;
Make install observe ${INSTPRIV}
 1.4 23-Sep-2000  simonb branches: 1.4.4; 1.4.6;
Use ${COPY} instead of -c for ${INSTALL} commands.
 1.3 31-May-2000  he Add handling of "make release".
 1.2 14-Dec-1999  thorpej branches: 1.2.2;
Make it possible to strip this down a little more.
 1.1 04-Feb-1997  thorpej branches: 1.1.20; 1.1.26; 1.1.32;
Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.1.32.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.1.26.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.1.20.1 13-Jul-2000  he Pull up revision 1.3 (requested by he):
Enhance the ``make release'' process:
o Build and install the distrib and boot bits
 1.2.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.4.6.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.4.4.2 16-Mar-2002  jdolecek Catch up with -current.
 1.4.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.5.2.4 07-Jan-2003  thorpej Sync with HEAD.
 1.5.2.3 28-Feb-2002  nathanw Catch up to -current.
 1.5.2.2 08-Jan-2002  nathanw Catch up to -current.
 1.5.2.1 08-Nov-2001  nathanw file Makefile was added on branch nathanw_sa on 2002-01-08 00:24:48 +0000
 1.8.198.1 11-May-2024  martin Pull up following revision(s) (requested by tsutsui in ticket #1838):

sys/arch/hp300/stand/uboot/Makefile: revision 1.11
sys/arch/hp300/stand/inst/Makefile: revision 1.11

Use LINKS to create hard links to generate proper METALOG files.

Also use the default ${PROG} variable and "install" target.

Fixes PR port-hp300/58211.
 1.8.194.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.10.2.2 22-Jun-2024  martin Pull up following revision(s) (requested by tsutsui in ticket #722):

sys/fs/cd9660/cd9660_util.c: revision 1.16
sys/arch/hp300/stand/common/clock.c: revision 1.14
sys/arch/hp300/stand/common/scsireg.h: revision 1.5
sys/arch/hp300/stand/common/scsireg.h: revision 1.6
sys/arch/hp300/stand/Makefile.buildboot: revision 1.38
sys/arch/hp300/include/bus.h: revision 1.23
sys/arch/hp300/stand/Makefile.buildboot: revision 1.39
sys/arch/hp300/stand/common/sd.c: revision 1.12
sys/arch/hp300/stand/common/prf.c: revision 1.6
sys/arch/hp300/stand/common/sd.c: revision 1.13
usr.sbin/installboot/installboot.8: revision 1.106
usr.sbin/installboot/Makefile: revision 1.59
sys/arch/hp300/stand/common/devopen.c: revision 1.14
usr.sbin/installboot/installboot.8: revision 1.107
sys/arch/hp300/stand/common/ite_dumb.c: revision 1.2
sys/arch/hp300/stand/common/devopen.c: revision 1.15
usr.sbin/installboot/installboot.8: revision 1.108
sys/fs/cd9660/cd9660_extern.h: revision 1.29
usr.sbin/installboot/installboot.8: revision 1.109
tools/Makefile.nbincludes: revision 1.11 (patch)
sys/arch/hp300/dev/rboxreg.h: revision 1.3
sys/arch/hp300/stand/common/scsivar.h: revision 1.5
sys/arch/hp300/dev/dnkbd.c: revision 1.14
sys/arch/hp300/hp300/trap.c: revision 1.156
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.12
sys/arch/hp300/dev/frodoreg.h: revision 1.6
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.13
sys/arch/hp300/stand/common/ite_sti.c: revision 1.2
sys/arch/hp300/stand/common/hil.c: revision 1.15
usr.sbin/installboot/arch/hp300.c: revision 1.18
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.14
sys/arch/hp300/dev/rbox.c: revision 1.4
usr.sbin/installboot/arch/hp300.c: revision 1.19
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.15
sys/sys/bootblock.h: revision 1.59
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.16
usr.sbin/installboot/installboot.h: revision 1.44
sys/arch/hp300/stand/mkboot/volhdr.h: file removal
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.17
sys/arch/hp300/dev/hpib.c: revision 1.45
usr.sbin/installboot/installboot.h: revision 1.45
usr.sbin/installboot/cd9660.c: revision 1.1
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.18
sys/arch/hp300/dev/topcatreg.h: revision 1.3
usr.sbin/installboot/cd9660.c: revision 1.2
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.19
sys/arch/hp300/stand/inst/inst.c: revision 1.25
sys/arch/hp300/stand/uboot/Makefile: revision 1.12
sys/arch/hp300/dev/dvbox.c: revision 1.4
sys/arch/hp300/dev/dma.c: revision 1.45
sys/arch/hp300/stand/uboot/Makefile: revision 1.13
sys/arch/hp300/stand/common/rd.c: revision 1.16
sys/arch/hp300/stand/inst/Makefile: revision 1.12
distrib/hp300/cdroms/installcd/Makefile: revision 1.4
sys/arch/hp300/stand/mkboot/volhdr.h: revision 1.6
sys/arch/hp300/stand/common/machdep.c: revision 1.16
usr.sbin/installboot/fstypes.c: revision 1.14
sys/arch/hp300/hp300/machdep.c: revision 1.238
sys/arch/hp300/include/cpu.h: revision 1.73
sys/arch/hp300/dev/diofbreg.h: revision 1.4
sys/arch/hp300/stand/common/scsi.c: revision 1.12
sys/arch/hp300/stand/common/netio.c: revision 1.19
sys/arch/hp300/stand/common/scsi.c: revision 1.13
sys/arch/hp300/dev/sti_sgc.c: revision 1.8
sys/arch/hp300/dev/rtc.c: revision 1.22
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.20
sys/arch/hp300/stand/common/conf.h: revision 1.4
sys/arch/hp300/hp300/autoconf.c: revision 1.111
sys/arch/hp300/stand/common/conf.c: revision 1.15
sys/arch/hp300/stand/mkboot/Makefile: revision 1.12
sys/arch/hp300/stand/mkboot/Makefile: revision 1.13
sys/arch/hp300/hp300/autoconf.c: revision 1.114
sys/arch/hp300/dev/dcmreg.h: revision 1.11
sys/arch/hp300/dev/diofbvar.h: revision 1.4
sys/arch/hp300/dev/dcm.c: revision 1.91
sys/fs/cd9660/cd9660_util.c: revision 1.15
sys/arch/hp300/dev/mcclock_frodo.c: revision 1.2

TAB/space cleanup.

installboot(8): formatting improvements

Use Ar foo instead of <foo>; this is mdoc.

Other formatting tweaks.
installboot(8): fix up markup

Don't overuse .Sy - when everything is highlighted, nothing is. Use
.Ic for options &c to get correct PostScript output (both are bold in
plain text).

Use Aq Ar inside .Pa, as both Pa and Ar are rendered as underscored
text in plain text output, and the distinction is lost.

Don't set examples in bold, but give them .Pp space around - they are
much easier to read this way.

Use consistent -width in FILES.
document how to use installboot on netbsd/vax.

PR/57909: Jan-Benedict Glaw: Don't include (build) timestamp when doing a
reproducible build
fix usage string, improve error handling.
add missing chunk for repro-build. fix gcc warnings.
avoid stringop truncation, fix copyright string to prevent assembler warnings.

Fix build as a tool (Jan-Benedict Glaw)

Fix integer overflow of strtol(3) for "loadpoint" address on ILP32 hosts.

This strtol(3) was introduced in rev 1.12 for PR/57909 after netbsd-10,
but it returns LONG_MAX (0x7FFFFFFF) for 0xFFF00000 on ILP32 hosts and
the wrong loadpoint causes "NOT ENOUGH MEMORY" error by the BOOTROMs
on loading uboot.lif on (at least) my 9000/360 and 9000/425t.

Misc cosmetic changes for mostly readability.
- KNF and add some newlines per blocks
- define and use proper bintobcd() macro
- make local functions and variables static

The same uboot.lif binaries are generated.

Rename ${PROGAOUT} -> ${PROGELF} to reflect reality.
Use proper signedness for the LIF file system data structures.

Ancient 4.3BSD used short and int for location, file size, file type,
and addresses etc. but all of them should be unsigned.

Also rename several variables and add comments for readability.
The LIF file system info can be found in "The HPDir Project" page:
https://www.hp9845.net/9845/projects/hpdir/
The same uboot.lif binaries are generated.

Add a preliminary CD boot support to uboot for preparation of PR/54455.
Briefly tested on mame, but not enalbed yet.

Recognize SCSI CD-ROM devices as a booted device properly.

Necessary for PR port-hp300/54455, to boot an md root root RAMDISK

kernel from CD-ROM without "WARNING: can't find match for bootdev:"
prompt.

Sync with src/sys/arch/hp300/stand/mkboot/volhdr.h rev 1.6.
https://mail-index.netbsd.org/source-changes/2024/05/07/msg151195.html

Use proper signedness for the LIF file system data structures.
mkboot should use this MI <sys/bootblock.h> and volhdr.h should
be removed soon.

Use MI <sys/bootblock.h> to refer LIF filesystem structures.
This should have been done when LIF definitions were initially added
to <sys/bootblock.h> for MI installboot(8).

Enable SUPPORT_CD on uboot.

Make cd9660_util.c usable in userland tools like installboot(8).

This was partially done for src/distrib/cdrom/macppc_installboot,
but more strict prototypes are necessary for native binary builds.

Install cd9660 related system headers for tools installboot(8) builds.

Reorder function prototypes per source files.

Add cd9660 support to search a bootloader file in the target file system.

Also add CD boot support for hp300, using a bootloader file in cd9660 fs.
This is a tool's part to close PR/54455.

HP 9000/300 machines read LIF directory entry allocated after
the LIF volume header at the top of the boot disk during bootstrap,
and a bootstrap file must be contiguously allocated on the disk
due to limitation of the LIF specification.

Current NetBSD/hp300's bootloader is larger than ~80KB so we have
to prepare a special 'boot' partition for FFS (that has only 8KB (ffsv1)
or 32KB (ffsv2) spaces) disks to put such a large bootloader.

On the other hand, on ISO9660 fs all files are allocated contiguously
so we can specify a bootloader file in the target ISO9660 directly
in the LIF directory entry.

Note we can simply use the existing "append" option to create bootable
CD ISO for hp300, but it looks some emulators (at leaset MAME) reject
such non-standard ISO files, i.e. with an appended bootloader file at
the end of the image.

Put a RAMDISK kernel and SYS_UBOOT into hp300 installcd to make it bootable.

This should finally close PR/54455.

Fix tools build errors on Cygwin.

Appease warnings on building tools/installboot on Cygwin.
 1.10.2.1 11-May-2024  martin Pull up following revision(s) (requested by tsutsui in ticket #684):

sys/arch/hp300/stand/uboot/Makefile: revision 1.11
sys/arch/hp300/stand/inst/Makefile: revision 1.11

Use LINKS to create hard links to generate proper METALOG files.

Also use the default ${PROG} variable and "install" target.

Fixes PR port-hp300/58211.
 1.18 11-Dec-2022  tsutsui Cleanup extern declarations.
 1.17 11-Jun-2016  dholland Change "tgets_s" back to "tgets". We obviously want to keep the bounds
argument, but there's no need to mess with the function name.
 1.16 05-Jun-2016  christos get rid of gets/tgets
 1.15 16-Jul-2008  tsutsui branches: 1.15.38; 1.15.58;
Change boot messages to replace build date and maker with kernrev.
 1.14 24-Dec-2005  perry branches: 1.14.74; 1.14.78; 1.14.80; 1.14.82; 1.14.84;
bare asm -> __asm
 1.13 11-Dec-2005  christos merge ktrace-lwp.
 1.12 20-Feb-2005  tsutsui branches: 1.12.4;
Use ANSI function decls.
 1.11 14-Nov-2003  tsutsui branches: 1.11.8; 1.11.10;
Misc cleanup:
- KNF
- WARNSfy
- remove __P()
- remove register declarations
- const'ify some variables
- make some local functions/variables static
- bcopy -> memcpy
- bcmp -> memcmp
- bzero -> memset
- space/TAB fix
etc.
 1.10 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.9 16-Mar-2002  gmcgarry branches: 1.9.12;
Move exec_hp300() out of uboot.c into its own file so that it can
be used by SYS_INST. SYS_INST can now boot ELF kernels inside the
miniroot.
 1.8 09-Oct-2001  tsutsui branches: 1.8.4;
Include <machine/bootinfo.h>
 1.7 01-Jul-2001  gmcgarry branches: 1.7.2; 1.7.4;
Sort boot options. Add -c for userconf.
 1.6 01-Jul-2001  gmcgarry Create an empty bootinfo structure.
 1.5 02-Jan-2001  simonb Convert both bootblocks and mkboot to use libsa's loadfile(), and make
both ELF aware.
 1.4 24-Sep-2000  jdolecek 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.3 27-Apr-1997  thorpej branches: 1.3.22;
CPU -> SPU
 1.2 04-Feb-1997  thorpej Add the ".gz" names of the kernels to the kernel names list. New
boot order is:

netbsd -> netbsd.gz -> netbsd.bak -> netbsd.bak.gz ->
netbsd.old -> netbsd.old.gz -> onetbsd -> onetbsd.gz
 1.1 04-Feb-1997  thorpej Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.3.22.2 05-Jan-2001  bouyer Sync with HEAD
 1.3.22.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.1 11-Oct-2001  fvdl Catch up with -current. Fix some bogons in the sparc64 kbd/ms
attach code. cd18xx conversion provided by mrg.
 1.7.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.7.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.8.4.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.8.4.1 09-Oct-2001  nathanw file uboot.c was added on branch nathanw_sa on 2002-04-01 07:40:01 +0000
 1.9.12.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.9.12.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.9.12.2 18-Sep-2004  skrll Sync with HEAD.
 1.9.12.1 03-Aug-2004  skrll Sync with HEAD
 1.11.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.11.8.1 29-Apr-2005  kent sync with -current
 1.12.4.1 21-Jun-2006  yamt sync with head.
 1.14.84.1 19-Oct-2008  haad Sync with HEAD.
 1.14.82.1 18-Jul-2008  simonb Sync with head.
 1.14.80.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.14.78.1 04-May-2009  yamt sync with head.
 1.14.74.1 28-Sep-2008  mjf Sync with HEAD.
 1.15.58.1 09-Jul-2016  skrll Sync with HEAD
 1.15.38.1 03-Dec-2017  jdolecek update from HEAD
 1.22 28-May-2025  tsutsui Bump bootloader versions to denote recent netboot and 362/382 sti changes.
 1.21 28-Apr-2020  tsutsui branches: 1.21.26;
Fix inappropriate error messages when nfs_mount() fails.

Noticed by Chris Hanson and his HP330 and confirmed on my HP425e.
Also bump revisions to denote visible changes.
Worth to pull up to netbsd-9.
 1.20 17-Jan-2016  tsutsui branches: 1.20.22;
Enable LIBSA_CREAD_NOCRC. PR/50638

Bump version to denote user visible change.
Tested on HP9000/382.
 1.19 26-Apr-2014  tsutsui branches: 1.19.4;
Bump versions to denote recent 425e related changes.
 1.18 12-Feb-2011  tsutsui branches: 1.18.4; 1.18.10; 1.18.14; 1.18.18; 1.18.28;
Bump version for 362 and 382 framebuffer support.
 1.17 10-Feb-2011  tsutsui Bump version to denote standalone ITE driver reorganization
pulled from OpenBSD.
 1.16 16-Jul-2008  tsutsui branches: 1.16.16; 1.16.22; 1.16.24;
Change boot messages to replace build date and maker with kernrev.
 1.15 20-Jul-2006  tsutsui branches: 1.15.58; 1.15.62; 1.15.64; 1.15.66; 1.15.68;
Identify models HP362 and HP382. From OpenBSD, tested on my HP382.

Note now options HP362 and options HP382 are required for these models
in your kernel config file.
 1.14 14-Dec-2001  gmcgarry branches: 1.14.32; 1.14.46; 1.14.50;
Bump version: Default to BOOTP network boot
 1.13 09-Nov-2001  scw branches: 1.13.2;
Bump the version numbers of all bootloaders which use loadfile_elfXX() now
that it tries hard to avoid backwards seeks.
 1.12 02-Aug-2001  bjh21 branches: 1.12.4;
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.11 02-Jan-2001  simonb branches: 1.11.4;
Convert both bootblocks and mkboot to use libsa's loadfile(), and make
both ELF aware.
 1.10 24-Sep-2000  jdolecek 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.9 12-May-1997  thorpej branches: 1.9.22;
Bump version: Added APCI console support
 1.8 27-Apr-1997  thorpej Bump version: Better SPU detection code
 1.7 10-Mar-1997  thorpej Bump version - we compute the kernel load address differently.
 1.6 04-Feb-1997  thorpej branches: 1.6.4;
Bump version: Add support for booting gzip'd kernels
 1.5 04-Feb-1997  thorpej Bump version: Reorganization of boot block code
 1.4 04-Feb-1997  thorpej Replay history: Added support for HP-IB cartridge tapes
 1.3 04-Feb-1997  thorpej Reply history: Merged network and disk boot programs
 1.2 04-Feb-1997  thorpej Replay history: Added support for network booting
 1.1 04-Feb-1997  thorpej Complete and total reorganization of the hp300 boot code, modeled
closely after the build process used by NetBSD/alpha's boot code.
 1.6.4.1 11-Mar-1997  is merge in changes from Trunk.
 1.9.22.2 05-Jan-2001  bouyer Sync with HEAD
 1.9.22.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.11.4.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.11.4.1 03-Aug-2001  lukem update to -current
 1.12.4.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.13.2.2 08-Jan-2002  nathanw Catch up to -current.
 1.13.2.1 09-Nov-2001  nathanw file version was added on branch nathanw_sa on 2002-01-08 00:24:48 +0000
 1.14.50.1 11-Aug-2006  yamt sync with head
 1.14.46.1 09-Sep-2006  rpaulo sync with head
 1.14.32.1 30-Dec-2006  yamt sync with head.
 1.15.68.1 19-Oct-2008  haad Sync with HEAD.
 1.15.66.1 18-Jul-2008  simonb Sync with head.
 1.15.64.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.15.62.1 04-May-2009  yamt sync with head.
 1.15.58.1 28-Sep-2008  mjf Sync with HEAD.
 1.16.24.1 17-Feb-2011  bouyer Sync with HEAD
 1.16.22.1 06-Jun-2011  jruoho Sync with HEAD.
 1.16.16.1 05-Mar-2011  rmind sync with head
 1.18.28.1 10-Aug-2014  tls Rebase.
 1.18.18.1 18-May-2014  rmind sync with head
 1.18.14.2 03-Dec-2017  jdolecek update from HEAD
 1.18.14.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.18.10.1 21-May-2014  bouyer Pull up following revision(s) (requested by tsutsui in ticket #1058):
sys/arch/hp300/conf/files.hp300: revision 1.88
sys/arch/hp300/include/autoconf.h: revision 1.13
sys/dev/ic/sti.c: revision 1.17
sys/arch/hp300/dev/frodo.c: revision 1.31
sys/arch/hp300/conf/GENERIC: revision 1.173
sys/arch/hp300/hp300/machdep.c: revision 1.229
sys/arch/hp300/dev/frodo.c: revision 1.32
sys/arch/hp300/hp300/autoconf.c: revision 1.102
sys/arch/hp300/dev/frodoreg.h: revision 1.5
sys/arch/hp300/stand/common/ite_sti.c: revision 1.1
sys/arch/hp300/stand/common/itevar.h: revision 1.16
sys/arch/hp300/hp300/autoconf.c: revision 1.105
sys/arch/hp300/dev/sti_sgcvar.h: revision 1.1
sys/arch/hp300/stand/common/apci.c: revision 1.12
sys/arch/hp300/stand/common/apci.c: revision 1.13
sys/arch/hp300/dev/dnkbd.c: revision 1.6
sys/arch/hp300/dev/dnkbd.c: revision 1.7
sys/arch/hp300/stand/inst/version: revision 1.12
sys/arch/hp300/dev/com_frodo.c: revision 1.9
sys/arch/hp300/stand/common/ite.c: revision 1.17
sys/arch/hp300/conf/GENERIC: revision 1.181
sys/arch/hp300/dev/sti_sgc.c: revision 1.1
sys/arch/hp300/stand/common/dnkbd.c: revision 1.13
sys/arch/hp300/dev/sti_sgc.c: revision 1.2
sys/dev/ic/stivar.h: revision 1.8
sys/arch/hp300/dev/rtc.c: revision 1.21
sys/arch/hp300/conf/INSTALL: revision 1.56
sys/arch/hp300/conf/INSTALL: revision 1.58
sys/arch/hp300/stand/uboot/version: revision 1.19
sys/arch/hp300/stand/common/samachdep.h: revision 1.17
sys/arch/hp300/stand/common/clock.c: revision 1.12
sys/arch/hp300/dev/mcclock_frodo.c: revision 1.1
sys/arch/hp300/stand/Makefile.buildboot: revision 1.34
sys/arch/hp300/conf/files.hp300: revision 1.87
Add sti at sgc framebuffer.
Ported from OpenBSD by kiyohara@.
Fix a botch on switching from apci (and dca) to MI com(4) 10 years ago.
I.e. fix apci device address per FRODO_BASE macro change
in frodoreg.h rev 1.2. Now bootloader works with serial console
on HP425e (which has only com at frodo).
Thanks to miod@openbsd for providing his 425e.
Add sti(4) at sgc screen console support. From (the late) OpenBSD/hp300.
Tested on HP9000/425e, which was sent from Miod Vallat and
demonstrated at Open Source unConference 2014 Kagawa.
Check the service switch on 425e to select apci serial console.
Taken from OpenBSD/hp300. See the following comment for details:
> * Check the service switch. On the 425e, this is a physical
> * switch, unlike other frodo-based machines, so we can use it
> * as a serial vs internal video selector, since the PROM can not
> * be configured for serial console.
Add proper RealTime Clock support for HP9000/425e.
As the OpenBSD/hp300 page says 425e doesn't have the traditional
RTC at intio (as it also lacks DCA 16550 serial at intio?),
but after a few hour investigation it turns out that
425e uses mc146818 compatible calendar clock in
the Apollo "frodo" utility chip and the frodo chip on
425e actually has the 32kHz OSC and is actually backed up
by the onboard lithium battery.
Tested on HP425e (with mcclock) and HP362 (with old rtc).
Add RTC support for HP9000/425e to bootloader too.
Also put several cleanup:
- make local functions and variables static
- use proper variable types
- some KNF
Note it turns out that extreme slowness of netboot on hp300 is
caused by the too slow access of the traditional RTC chip at intio
(i.e. netboot on 425e is so much faster than others). Oh well.
Add proper consinit(9) support for sti(4) at sgc framebuffer on hp300.
The cnattach functions for sti(4) and service switch check method
for 425e in com_frodo.c are taken from OpenBSD.
The strategy how to choose the console device in hp300_cninit() is
quite diverged from 4.4BSD and OpenBSD so it's tweaked by me.
Also put several changes in sti_sgc.c to reduce diffs from OpenBSD/hp300.
Tested on 425e and 362 (which still uses gendiofb(4), not sti(4)).
XXX: sti(4) requires uvm_km_alloc(9) and uvm_map_protect(9)
to copy and call ROM functions on the executable memory region, so
it can be called before UVM and related initializations are complete.
Probably it's time to consider about MI "deferred consinit()" API
in init_main.c (or elsewhere) for modern complicated VM system...
Also fix the apci device address in dnkbd.c as apci.c rev 1.12:
http://mail-index.netbsd.org/source-changes/2014/04/10/msg053940.html
Finally dnkbd(4) is confirmed working at least on bootloader.
Thanks again to Miod Vallat.
Make the Apollo Domain keyboard actually work.
Tested on HP9000/425e and the keyboard model A1630-82001 R2 (RX-60857-HW)
provided by Miod Vallat. Mouse support needs more work.
Pull random notes on the Apollo Domain keyboard from ancient PR/3528.
Bump versions to denote recent 425e related changes.
Probe mcclock only on 425e to avoid an extra "not configured" message.
Add and enable sti(4) at sgc in install kernels for 425e.
Tested on both serial console and framebuffer console.
(switched by the service switch on the back panel)
 1.18.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.19.4.1 19-Mar-2016  skrll Sync with HEAD
 1.20.22.1 01-May-2020  martin Pull up following revision(s) (requested by tsutsui in ticket #880):

sys/arch/hp300/stand/uboot/version: revision 1.21
sys/arch/hp300/stand/inst/version: revision 1.14
sys/arch/hp300/stand/common/netio.c: revision 1.17

Fix inappropriate error messages when nfs_mount() fails.

Noticed by Chris Hanson and his HP332 and confirmed on my HP425e.

Also bump revisions to denote visible changes.
Worth to pull up to netbsd-9.
 1.21.26.1 02-Aug-2025  perseant Sync with HEAD

RSS XML Feed