Home | History | Annotate | only in /src/sys/arch/luna68k/stand/boot
History log of /src/sys/arch/luna68k/stand/boot
RevisionDateAuthorComments
 1.18 15-Jun-2021  tsutsui Specify -fno-unwind-tables to shrink binary size. Tested on nono.
 1.17 24-May-2019  tsutsui branches: 1.17.14;
LUNA's firmware requires OMAGIC a.out.
 1.16 02-Jan-2019  christos use the right version of ELF2AOUT
 1.15 28-Sep-2018  isaki Add missing link message.
 1.14 12-Nov-2017  tsutsui branches: 1.14.2; 1.14.4;
Explicitly set NOPIE. GOT seems problematic on elf2aout(1) conversion.

Fixes silent hangup of luna68k boot.
Should be pulled up to netbsd-8.

Current bsd.own.mk sets NOPIE in case of BINDIR=/usr/mdec for standalone
programs and in luna68k case it's defined in ../Makefile.inc.
However, many bootloader Makefiles include bsd.own.mk first to override
CFLAGS etc. and Makefile.inc is not included (so BINDIR is not set) yet
at the point.
 1.13 08-Apr-2017  christos branches: 1.13.6;
centralize vers.c building for standalone programs.
 1.12 17-Jan-2016  tsutsui branches: 1.12.2; 1.12.4;
Enable LIBSA_CREAD_NOCRC. PR/50638

Also bump version to denote user visible change.
Tested on LUNA-II.
 1.11 16-Jan-2014  christos branches: 1.11.6;
eliminate use of bsd.sys.mk from Makefiles
 1.10 10-Jan-2014  tsutsui Reorgenize boot device configuration. The idea is taken from OpenBSD/luna88k.

- remove kernel-like autoconfiguration to probe bootable devices
- initialize SCSI and Ethernet controllers statically instead
- reorganize device softc structures per autoconf removal
- probe and print all SCSI disks (but don't assign unit numbers)
- make sdopen() to recheck the device and allocate softc dynamically
- use controller number and SCSI target ID (ctlr * 10 + id) to specify
the boot disk on the "boot" command arg
- bump version to denote changes

Now bootloader works as the following:
---
>> NetBSD/luna68k boot, Revision 1.8 (Wed Jan 8 22:13:12 JST 2014)
>> (based on Stinger ver 0.0 [Phase-31])

Machine model = LUNA-II
Physical Memory = 0x4000000 (64 MB)

sc0 at 0xe1000000: async, parity, ID 7
ID 3: TEAC FC-1 HGF 10 rev , 512 bytes/sect x 2879 sectors
ID 6: IBM DPES-31080 rev S31Q, 512 bytes/sect x 2118143 sectors
sc1 at 0xe1000040: async, parity, ID 7
ID 6: MELCO DSC-G rev 1.00, 512 bytes/sect x 62533295 sectors
le0: Am7990 LANCE Ethernet, mem at 0x71010000
le0: Ethernet address = 00:00:0a:03:42:77

Press return to boot now, any other key for boot menu
booting sd(16,0)netbsd - starting in 0 seconds.
auto-boot sd(16,0)netbsd
1911696+96040 [280480+159179]=0x255a30
:
 1.9 22-Jan-2013  tsutsui branches: 1.9.2; 1.9.4; 1.9.6;
Whitespace cleanup.
 1.8 21-Jan-2013  tsutsui Add support for "await key" to abort autoboot and get boot menu.
Also add command help. Bump version.
 1.7 20-Jan-2013  tsutsui Specify text address via Makefile rather than hardcoding in boot.ldscript.
 1.6 16-Jan-2013  tsutsui Enable and add ls command for ufs.
 1.5 13-Jan-2013  tsutsui Add netboot support.
Based on ews4800mips, mvme68k, and x68k standalone drivers.
Also bump version.

Tested on LUNA-I.

XXX: We really need proper documents about libsa APIs.
 1.4 10-Jan-2013  tsutsui Revert to using elf2aout(1) to build a.out binary.
a.out binary linked by ldscript doesn't work on some uncertain conditions.
 1.3 10-Jan-2013  tsutsui Link the target boot binary as a.out directly rather than using elf2aout(1).
Confirmed working on LUNA-I.
 1.2 09-Jan-2013  tsutsui Make sure to print proper bootprog name in banner.
 1.1 05-Jan-2013  tsutsui First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.9.6.4 03-Dec-2017  jdolecek update from HEAD
 1.9.6.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.9.6.2 25-Feb-2013  tls resync with head
 1.9.6.1 22-Jan-2013  tls file Makefile was added on branch tls-maxphys on 2013-02-25 00:28:48 +0000
 1.9.4.1 18-May-2014  rmind sync with head
 1.9.2.3 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.9.2.2 23-Jan-2013  yamt sync with head
 1.9.2.1 22-Jan-2013  yamt file Makefile was added on branch yamt-pagecache on 2013-01-23 00:05:52 +0000
 1.11.6.2 28-Aug-2017  skrll Sync with HEAD
 1.11.6.1 19-Mar-2016  skrll Sync with HEAD
 1.12.4.1 21-Apr-2017  bouyer Sync with HEAD
 1.12.2.1 26-Apr-2017  pgoyette Sync with HEAD
 1.13.6.1 22-Nov-2017  martin Pull up following revision(s) (requested by tsutsui in ticket #376):
sys/arch/luna68k/stand/boot/Makefile: revision 1.14
Explicitly set NOPIE. GOT seems problematic on elf2aout(1) conversion.
Fixes silent hangup of luna68k boot.
Should be pulled up to netbsd-8.
Current bsd.own.mk sets NOPIE in case of BINDIR=/usr/mdec for standalone
programs and in luna68k case it's defined in ../Makefile.inc.
However, many bootloader Makefiles include bsd.own.mk first to override
CFLAGS etc. and Makefile.inc is not included (so BINDIR is not set) yet
at the point.
 1.14.4.1 10-Jun-2019  christos Sync with HEAD
 1.14.2.2 18-Jan-2019  pgoyette Synch with HEAD
 1.14.2.1 30-Sep-2018  pgoyette Ssync with HEAD
 1.17.14.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.11 30-Jun-2019  tsutsui Pull OpenBSD/luna88k board.h to define SX9100 board device addresses.

Also replace magic addresses with macro where appropriate.
 1.10 10-Jan-2014  tsutsui branches: 1.10.30;
Reorgenize boot device configuration. The idea is taken from OpenBSD/luna88k.

- remove kernel-like autoconfiguration to probe bootable devices
- initialize SCSI and Ethernet controllers statically instead
- reorganize device softc structures per autoconf removal
- probe and print all SCSI disks (but don't assign unit numbers)
- make sdopen() to recheck the device and allocate softc dynamically
- use controller number and SCSI target ID (ctlr * 10 + id) to specify
the boot disk on the "boot" command arg
- bump version to denote changes

Now bootloader works as the following:
---
>> NetBSD/luna68k boot, Revision 1.8 (Wed Jan 8 22:13:12 JST 2014)
>> (based on Stinger ver 0.0 [Phase-31])

Machine model = LUNA-II
Physical Memory = 0x4000000 (64 MB)

sc0 at 0xe1000000: async, parity, ID 7
ID 3: TEAC FC-1 HGF 10 rev , 512 bytes/sect x 2879 sectors
ID 6: IBM DPES-31080 rev S31Q, 512 bytes/sect x 2118143 sectors
sc1 at 0xe1000040: async, parity, ID 7
ID 6: MELCO DSC-G rev 1.00, 512 bytes/sect x 62533295 sectors
le0: Am7990 LANCE Ethernet, mem at 0x71010000
le0: Ethernet address = 00:00:0a:03:42:77

Press return to boot now, any other key for boot menu
booting sd(16,0)netbsd - starting in 0 seconds.
auto-boot sd(16,0)netbsd
1911696+96040 [280480+159179]=0x255a30
:
 1.9 03-Jan-2014  tsutsui Misc cleanup from OpenBSD/luna88k.

- remove unused code
- use proper prefix for structure members for readability
 1.8 03-Jan-2014  tsutsui Remove unused code (from OpenBSD/luna88k). Some KNF.
 1.7 22-Jan-2013  tsutsui branches: 1.7.2; 1.7.4; 1.7.6;
Whitespace cleanup.
 1.6 14-Jan-2013  tsutsui Use unsigned for device address.
 1.5 14-Jan-2013  tsutsui Remove hp300 specific select code and use proper hw address to match device.
 1.4 14-Jan-2013  tsutsui Remove unused hw_id and hw_id2 members from device info.
They are valid only on hp300.
 1.3 14-Jan-2013  tsutsui Fix drivers to make secondary SPC SCSI on LUNA-II work properly.
Also bump version.

Now we can load a NetBSD kernel from external SCSI disks on LUNA-II.
(and netboot on LUNA-II also works)
 1.2 12-Jan-2013  tsutsui Fix warnings on DEBUG build.
 1.1 05-Jan-2013  tsutsui First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.7.6.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.7.6.2 25-Feb-2013  tls resync with head
 1.7.6.1 22-Jan-2013  tls file autoconf.c was added on branch tls-maxphys on 2013-02-25 00:28:48 +0000
 1.7.4.1 18-May-2014  rmind sync with head
 1.7.2.3 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.7.2.2 23-Jan-2013  yamt sync with head
 1.7.2.1 22-Jan-2013  yamt file autoconf.c was added on branch yamt-pagecache on 2013-01-23 00:05:52 +0000
 1.10.30.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.1 21-Jan-2013  tsutsui branches: 1.1.2; 1.1.6;
Add support for "await key" to abort autoboot and get boot menu.
Also add command help. Bump version.
 1.1.6.2 25-Feb-2013  tls resync with head
 1.1.6.1 21-Jan-2013  tls file awaitkey.c was added on branch tls-maxphys on 2013-02-25 00:28:48 +0000
 1.1.2.2 23-Jan-2013  yamt sync with head
 1.1.2.1 21-Jan-2013  yamt file awaitkey.c was added on branch yamt-pagecache on 2013-01-23 00:05:52 +0000
 1.6 14-Feb-2015  tsutsui Misc KNF and cosmetics.
 1.5 11-Jan-2014  tsutsui branches: 1.5.6;
Misc KNF and cosmetics.
 1.4 21-Jan-2013  tsutsui branches: 1.4.2; 1.4.4; 1.4.6;
Add support for "await key" to abort autoboot and get boot menu.
Also add command help. Bump version.
 1.3 20-Jan-2013  tsutsui Remove unused bmcintr() function.
 1.2 20-Jan-2013  tsutsui No need to include <sys/systm.h> in standalone sources.
 1.1 05-Jan-2013  tsutsui First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.4.6.4 03-Dec-2017  jdolecek update from HEAD
 1.4.6.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.4.6.2 25-Feb-2013  tls resync with head
 1.4.6.1 21-Jan-2013  tls file bmc.c was added on branch tls-maxphys on 2013-02-25 00:28:48 +0000
 1.4.4.1 18-May-2014  rmind sync with head
 1.4.2.3 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.4.2.2 23-Jan-2013  yamt sync with head
 1.4.2.1 21-Jan-2013  yamt file bmc.c was added on branch yamt-pagecache on 2013-01-23 00:05:52 +0000
 1.5.6.1 06-Apr-2015  skrll Sync with HEAD
 1.10 05-Jul-2024  andvar fix various typos in comments and log messages, mainly s/hight/high/
s/hight/height/ and removing double m in time(ing).
 1.9 13-Oct-2023  tsutsui branches: 1.9.6;
Fix spelling. From OpenBSD/luna88k.
 1.8 30-Jun-2019  tsutsui Pull OpenBSD/luna88k board.h to define SX9100 board device addresses.

Also replace magic addresses with macro where appropriate.
 1.7 14-Feb-2015  tsutsui branches: 1.7.18;
Make local functions and variables static.
 1.6 14-Feb-2015  tsutsui Misc KNF and cosmetics.
 1.5 14-Feb-2015  tsutsui Use proper signedness and exact-width interger types.
 1.4 11-Jan-2014  tsutsui branches: 1.4.6;
Misc KNF and cosmetics.
 1.3 02-Jan-2014  tsutsui Misc cleanup. Mostly from OpenBSD/luna88k.

- fix isprint() macro
- hight -> height
- remove an unused function
- adjust tabs/spaces
- constify the bitmap font
- consistently use #define<space>
- use #if 0/#endif to disable code block
- u_long -> uint32_t, u_short -> uint16_t
- some KNF
 1.2 20-Jan-2013  tsutsui branches: 1.2.2; 1.2.4; 1.2.6;
No need to include <sys/systm.h> in standalone sources.
 1.1 05-Jan-2013  tsutsui First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.2.6.4 03-Dec-2017  jdolecek update from HEAD
 1.2.6.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2.6.2 25-Feb-2013  tls resync with head
 1.2.6.1 20-Jan-2013  tls file bmd.c was added on branch tls-maxphys on 2013-02-25 00:28:48 +0000
 1.2.4.1 18-May-2014  rmind sync with head
 1.2.2.3 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.2.2 23-Jan-2013  yamt sync with head
 1.2.2.1 20-Jan-2013  yamt file bmd.c was added on branch yamt-pagecache on 2013-01-23 00:05:53 +0000
 1.4.6.1 06-Apr-2015  skrll Sync with HEAD
 1.7.18.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.9.6.1 02-Aug-2025  perseant Sync with HEAD
 1.7 11-Jan-2014  tsutsui ctually remove all references to obsolete stinger.h.
 1.6 11-Jan-2014  tsutsui Add support to pass boothowto and bootdev info from bootloader to kernel.

Bootloader side changes:
- make boot command parse boothowto flags (-ads etc.)
- pass boothowto and bootdev info to the kernel via %d7 and %d6
as the old 4.4BSD/luna68k kernel expected
- remove unused and now unnecessary "howto" (how_to_boot) command
- export and tweak make_device() in devopen.c to prepare bootdev info
- remove unused and commented out get_boot_device()
 1.5 10-Jan-2014  tsutsui Reorgenize boot device configuration. The idea is taken from OpenBSD/luna88k.

- remove kernel-like autoconfiguration to probe bootable devices
- initialize SCSI and Ethernet controllers statically instead
- reorganize device softc structures per autoconf removal
- probe and print all SCSI disks (but don't assign unit numbers)
- make sdopen() to recheck the device and allocate softc dynamically
- use controller number and SCSI target ID (ctlr * 10 + id) to specify
the boot disk on the "boot" command arg
- bump version to denote changes

Now bootloader works as the following:
---
>> NetBSD/luna68k boot, Revision 1.8 (Wed Jan 8 22:13:12 JST 2014)
>> (based on Stinger ver 0.0 [Phase-31])

Machine model = LUNA-II
Physical Memory = 0x4000000 (64 MB)

sc0 at 0xe1000000: async, parity, ID 7
ID 3: TEAC FC-1 HGF 10 rev , 512 bytes/sect x 2879 sectors
ID 6: IBM DPES-31080 rev S31Q, 512 bytes/sect x 2118143 sectors
sc1 at 0xe1000040: async, parity, ID 7
ID 6: MELCO DSC-G rev 1.00, 512 bytes/sect x 62533295 sectors
le0: Am7990 LANCE Ethernet, mem at 0x71010000
le0: Ethernet address = 00:00:0a:03:42:77

Press return to boot now, any other key for boot menu
booting sd(16,0)netbsd - starting in 0 seconds.
auto-boot sd(16,0)netbsd
1911696+96040 [280480+159179]=0x255a30
:
 1.4 03-Jan-2014  tsutsui Disable unnecessary boot device check. From OpenBSD/luna88k.
 1.3 05-Mar-2013  tsutsui branches: 1.3.6;
Check netboot and set proper default boot device.
Also bump version.
 1.2 21-Jan-2013  tsutsui branches: 1.2.2; 1.2.6;
Add support for "await key" to abort autoboot and get boot menu.
Also add command help. Bump version.
 1.1 05-Jan-2013  tsutsui First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.2.6.4 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2.6.3 23-Jun-2013  tls resync from head
 1.2.6.2 25-Feb-2013  tls resync with head
 1.2.6.1 21-Jan-2013  tls file boot.c was added on branch tls-maxphys on 2013-02-25 00:28:48 +0000
 1.2.2.3 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.2.2 23-Jan-2013  yamt sync with head
 1.2.2.1 21-Jan-2013  yamt file boot.c was added on branch yamt-pagecache on 2013-01-23 00:05:53 +0000
 1.3.6.1 18-May-2014  rmind sync with head
 1.5 26-Jan-2013  tsutsui branches: 1.5.4;
Add proper padding to text section for elf2aout conversion.

The data and bss sections are 8 byte aligned on m68k ELF format,
but a.out header doesn't have section addresses and only
contains size values, so we have to pad size of text section
to make data section get aligned even after elf2aout.

Note elf2aout merges ELF data section into a.out text section
if binary is OMAGIC (i.e. text is writable too) so only
BSS section address was affected (and was almost harmless).
 1.4 20-Jan-2013  tsutsui branches: 1.4.2;
Specify text address via Makefile rather than hardcoding in boot.ldscript.
 1.3 10-Jan-2013  tsutsui Revert to using elf2aout(1) to build a.out binary.
a.out binary linked by ldscript doesn't work on some uncertain conditions.
 1.2 10-Jan-2013  tsutsui Link the target boot binary as a.out directly rather than using elf2aout(1).
Confirmed working on LUNA-I.
 1.1 05-Jan-2013  tsutsui First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.4.2.3 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.4.2.2 23-Jan-2013  yamt sync with head
 1.4.2.1 20-Jan-2013  yamt file boot.ldscript was added on branch yamt-pagecache on 2013-01-23 00:05:53 +0000
 1.5.4.2 25-Feb-2013  tls resync with head
 1.5.4.1 26-Jan-2013  tls file boot.ldscript was added on branch tls-maxphys on 2013-02-25 00:28:48 +0000
 1.4 11-Jan-2014  tsutsui Add support to pass boothowto and bootdev info from bootloader to kernel.

Bootloader side changes:
- make boot command parse boothowto flags (-ads etc.)
- pass boothowto and bootdev info to the kernel via %d7 and %d6
as the old 4.4BSD/luna68k kernel expected
- remove unused and now unnecessary "howto" (how_to_boot) command
- export and tweak make_device() in devopen.c to prepare bootdev info
- remove unused and commented out get_boot_device()
 1.3 16-Jan-2013  tsutsui branches: 1.3.2; 1.3.4; 1.3.6;
Add UFS2 support. Also bump version.
 1.2 13-Jan-2013  tsutsui Add netboot support.
Based on ews4800mips, mvme68k, and x68k standalone drivers.
Also bump version.

Tested on LUNA-I.

XXX: We really need proper documents about libsa APIs.
 1.1 05-Jan-2013  tsutsui First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.3.6.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.3.6.2 25-Feb-2013  tls resync with head
 1.3.6.1 16-Jan-2013  tls file conf.c was added on branch tls-maxphys on 2013-02-25 00:28:48 +0000
 1.3.4.1 18-May-2014  rmind sync with head
 1.3.2.3 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.3.2.2 23-Jan-2013  yamt sync with head
 1.3.2.1 16-Jan-2013  yamt file conf.c was added on branch yamt-pagecache on 2013-01-23 00:05:53 +0000
 1.3 14-Feb-2015  tsutsui Misc KNF and cosmetics.
 1.2 11-Jan-2014  tsutsui branches: 1.2.6;
Misc KNF and cosmetics.
 1.1 05-Jan-2013  tsutsui branches: 1.1.2; 1.1.4; 1.1.6;
First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.1.6.4 03-Dec-2017  jdolecek update from HEAD
 1.1.6.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.6.2 25-Feb-2013  tls resync with head
 1.1.6.1 05-Jan-2013  tls file cons.c was added on branch tls-maxphys on 2013-02-25 00:28:48 +0000
 1.1.4.1 18-May-2014  rmind sync with head
 1.1.2.3 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.2.2 23-Jan-2013  yamt sync with head
 1.1.2.1 05-Jan-2013  yamt file cons.c was added on branch yamt-pagecache on 2013-01-23 00:05:53 +0000
 1.2.6.1 06-Apr-2015  skrll Sync with HEAD
 1.8 10-Jan-2014  tsutsui Reorgenize boot device configuration. The idea is taken from OpenBSD/luna88k.

- remove kernel-like autoconfiguration to probe bootable devices
- initialize SCSI and Ethernet controllers statically instead
- reorganize device softc structures per autoconf removal
- probe and print all SCSI disks (but don't assign unit numbers)
- make sdopen() to recheck the device and allocate softc dynamically
- use controller number and SCSI target ID (ctlr * 10 + id) to specify
the boot disk on the "boot" command arg
- bump version to denote changes

Now bootloader works as the following:
---
>> NetBSD/luna68k boot, Revision 1.8 (Wed Jan 8 22:13:12 JST 2014)
>> (based on Stinger ver 0.0 [Phase-31])

Machine model = LUNA-II
Physical Memory = 0x4000000 (64 MB)

sc0 at 0xe1000000: async, parity, ID 7
ID 3: TEAC FC-1 HGF 10 rev , 512 bytes/sect x 2879 sectors
ID 6: IBM DPES-31080 rev S31Q, 512 bytes/sect x 2118143 sectors
sc1 at 0xe1000040: async, parity, ID 7
ID 6: MELCO DSC-G rev 1.00, 512 bytes/sect x 62533295 sectors
le0: Am7990 LANCE Ethernet, mem at 0x71010000
le0: Ethernet address = 00:00:0a:03:42:77

Press return to boot now, any other key for boot menu
booting sd(16,0)netbsd - starting in 0 seconds.
auto-boot sd(16,0)netbsd
1911696+96040 [280480+159179]=0x255a30
:
 1.7 03-Jan-2014  tsutsui Misc cleanup from OpenBSD/luna88k.

- remove unused code
- use proper prefix for structure members for readability
 1.6 03-Jan-2014  tsutsui Remove unused code (from OpenBSD/luna88k). Some KNF.
 1.5 14-Jan-2013  tsutsui branches: 1.5.2; 1.5.4; 1.5.6;
Use unsigned for device address.
 1.4 14-Jan-2013  tsutsui Remove hp300 specific select code and use proper hw address to match device.
 1.3 14-Jan-2013  tsutsui Remove unused hw_id and hw_id2 members from device info.
They are valid only on hp300.
 1.2 13-Jan-2013  tsutsui Remove unused function members from struct driver.
This makes adding other drivers easier.
 1.1 05-Jan-2013  tsutsui First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.5.6.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.5.6.2 25-Feb-2013  tls resync with head
 1.5.6.1 14-Jan-2013  tls file device.h was added on branch tls-maxphys on 2013-02-25 00:28:48 +0000
 1.5.4.1 18-May-2014  rmind sync with head
 1.5.2.3 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.2.2 23-Jan-2013  yamt sync with head
 1.5.2.1 14-Jan-2013  yamt file device.h was added on branch yamt-pagecache on 2013-01-23 00:05:53 +0000
 1.11 01-Sep-2015  tsutsui Use the default boot device if a kernel name without device is specificed.
 1.10 01-Sep-2015  tsutsui Fix indent.
 1.9 14-Feb-2015  tsutsui Misc KNF and cosmetics.
 1.8 21-Apr-2014  tsutsui branches: 1.8.4;
Fix stupid botches in previous.

Use a proper device unit number if a unit number or non-default device
is specified on the boot command.
 1.7 16-Apr-2014  tsutsui Use booted device unit if no unit number is specified on boot command.

Bump version to denote a visible change.
 1.6 11-Jan-2014  tsutsui branches: 1.6.2;
Add support to pass boothowto and bootdev info from bootloader to kernel.

Bootloader side changes:
- make boot command parse boothowto flags (-ads etc.)
- pass boothowto and bootdev info to the kernel via %d7 and %d6
as the old 4.4BSD/luna68k kernel expected
- remove unused and now unnecessary "howto" (how_to_boot) command
- export and tweak make_device() in devopen.c to prepare bootdev info
- remove unused and commented out get_boot_device()
 1.5 10-Jan-2014  tsutsui Reorgenize boot device configuration. The idea is taken from OpenBSD/luna88k.

- remove kernel-like autoconfiguration to probe bootable devices
- initialize SCSI and Ethernet controllers statically instead
- reorganize device softc structures per autoconf removal
- probe and print all SCSI disks (but don't assign unit numbers)
- make sdopen() to recheck the device and allocate softc dynamically
- use controller number and SCSI target ID (ctlr * 10 + id) to specify
the boot disk on the "boot" command arg
- bump version to denote changes

Now bootloader works as the following:
---
>> NetBSD/luna68k boot, Revision 1.8 (Wed Jan 8 22:13:12 JST 2014)
>> (based on Stinger ver 0.0 [Phase-31])

Machine model = LUNA-II
Physical Memory = 0x4000000 (64 MB)

sc0 at 0xe1000000: async, parity, ID 7
ID 3: TEAC FC-1 HGF 10 rev , 512 bytes/sect x 2879 sectors
ID 6: IBM DPES-31080 rev S31Q, 512 bytes/sect x 2118143 sectors
sc1 at 0xe1000040: async, parity, ID 7
ID 6: MELCO DSC-G rev 1.00, 512 bytes/sect x 62533295 sectors
le0: Am7990 LANCE Ethernet, mem at 0x71010000
le0: Ethernet address = 00:00:0a:03:42:77

Press return to boot now, any other key for boot menu
booting sd(16,0)netbsd - starting in 0 seconds.
auto-boot sd(16,0)netbsd
1911696+96040 [280480+159179]=0x255a30
:
 1.4 03-Jan-2014  tsutsui Pull more fixes from OpenBSD/luna88k:

- accept empty controller and partition numbers, as well as empty filenames,
and use defaults (0, 0 and "netbsd") instead of complaining the boot path
is invalid
- move a macro where actually necessary

Also bump version to denote the user visible change.
 1.3 16-Jan-2013  tsutsui branches: 1.3.2; 1.3.4; 1.3.6;
Add UFS2 support. Also bump version.
 1.2 13-Jan-2013  tsutsui Add netboot support.
Based on ews4800mips, mvme68k, and x68k standalone drivers.
Also bump version.

Tested on LUNA-I.

XXX: We really need proper documents about libsa APIs.
 1.1 05-Jan-2013  tsutsui First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.3.6.4 03-Dec-2017  jdolecek update from HEAD
 1.3.6.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.3.6.2 25-Feb-2013  tls resync with head
 1.3.6.1 16-Jan-2013  tls file devopen.c was added on branch tls-maxphys on 2013-02-25 00:28:48 +0000
 1.3.4.1 18-May-2014  rmind sync with head
 1.3.2.3 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.3.2.2 23-Jan-2013  yamt sync with head
 1.3.2.1 16-Jan-2013  yamt file devopen.c was added on branch yamt-pagecache on 2013-01-23 00:05:53 +0000
 1.6.2.1 10-Aug-2014  tls Rebase.
 1.8.4.2 22-Sep-2015  skrll Sync with HEAD
 1.8.4.1 06-Apr-2015  skrll Sync with HEAD
 1.10 14-Feb-2015  tsutsui Explicitly denote static functions.
 1.9 14-Feb-2015  tsutsui Don't use cnputc() directly in an application layer.
 1.8 14-Feb-2015  tsutsui Misc KNF and cosmetics.
 1.7 14-Feb-2015  tsutsui Use proper signedness and exact-width interger types.
 1.6 02-Jan-2015  christos We have three sets of DTYPE_ constants in the kernel:
altq Drop Type
disklabel Disk Type
file Descriptor Type
(not to mention constants that contain the string DTYPE).
Let's make them two, by changing the disklabel one to be DisK TYPE since the
other disklabel constants seem to do that. Not many userland programs use
these constants (and the ones that they do are mostly in ifdefs). They will
be fixed shortly.
 1.5 24-Mar-2014  martin branches: 1.5.6;
PR port-luna68k/48677: fix some typos.
From shinnashi takeshi.
 1.4 11-Jan-2014  tsutsui Misc KNF and cosmetics.
 1.3 22-Jan-2013  tsutsui branches: 1.3.2; 1.3.4; 1.3.6;
Whitespace cleanup.
 1.2 10-Jan-2013  tsutsui Make "disklabel" command print correct disklabel info.
- use exact-width interger types to define on-disk format
(daddr_t could be a different size)
- use proper LABELOFFSET to locate BSD disklabel
(LABELOFFSET for luna68k is 64 as 4.4BSD-Lite2 while other
ports that use sun_disklabel use 128)
 1.1 05-Jan-2013  tsutsui First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.3.6.4 03-Dec-2017  jdolecek update from HEAD
 1.3.6.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.3.6.2 25-Feb-2013  tls resync with head
 1.3.6.1 22-Jan-2013  tls file disklabel.c was added on branch tls-maxphys on 2013-02-25 00:28:48 +0000
 1.3.4.1 18-May-2014  rmind sync with head
 1.3.2.3 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.3.2.2 23-Jan-2013  yamt sync with head
 1.3.2.1 22-Jan-2013  yamt file disklabel.c was added on branch yamt-pagecache on 2013-01-23 00:05:53 +0000
 1.5.6.1 06-Apr-2015  skrll Sync with HEAD
 1.3 02-Jan-2014  tsutsui Misc cleanup. Mostly from OpenBSD/luna88k.

- fix isprint() macro
- hight -> height
- remove an unused function
- adjust tabs/spaces
- constify the bitmap font
- consistently use #define<space>
- use #if 0/#endif to disable code block
- u_long -> uint32_t, u_short -> uint16_t
- some KNF
 1.2 20-Jan-2013  tsutsui branches: 1.2.2; 1.2.4; 1.2.6;
No need to include <sys/systm.h> in standalone sources.
 1.1 05-Jan-2013  tsutsui First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.2.6.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2.6.2 25-Feb-2013  tls resync with head
 1.2.6.1 20-Jan-2013  tls file font.c was added on branch tls-maxphys on 2013-02-25 00:28:49 +0000
 1.2.4.1 18-May-2014  rmind sync with head
 1.2.2.3 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.2.2 23-Jan-2013  yamt sync with head
 1.2.2.1 20-Jan-2013  yamt file font.c was added on branch yamt-pagecache on 2013-01-23 00:05:53 +0000
 1.4 11-Jan-2014  tsutsui Misc KNF and cosmetics.
 1.3 03-Jan-2014  tsutsui Pull more fixes from OpenBSD/luna88k:

- Bring getline() - a.k.a libsa gets() with a prompt prefix - in par with libsa
gets(), featurewise; this means support for ^u to clear the input.
- constify
 1.2 20-Jan-2013  tsutsui branches: 1.2.2; 1.2.4; 1.2.6;
Don't call internal cngetc() and cnputc() directly.
Use public getchar() and putchar() instead.
 1.1 05-Jan-2013  tsutsui First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.2.6.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2.6.2 25-Feb-2013  tls resync with head
 1.2.6.1 20-Jan-2013  tls file getline.c was added on branch tls-maxphys on 2013-02-25 00:28:49 +0000
 1.2.4.1 18-May-2014  rmind sync with head
 1.2.2.3 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.2.2 23-Jan-2013  yamt sync with head
 1.2.2.1 20-Jan-2013  yamt file getline.c was added on branch yamt-pagecache on 2013-01-23 00:05:53 +0000
 1.3 30-Jun-2019  tsutsui Pull OpenBSD/luna88k board.h to define SX9100 board device addresses.

Also replace magic addresses with macro where appropriate.
 1.2 21-Nov-2014  christos branches: 1.2.20;
need clock_subr.h for bcdtobin()
 1.1 13-Jan-2013  tsutsui branches: 1.1.2; 1.1.6;
Add netboot support.
Based on ews4800mips, mvme68k, and x68k standalone drivers.
Also bump version.

Tested on LUNA-I.

XXX: We really need proper documents about libsa APIs.
 1.1.6.3 03-Dec-2017  jdolecek update from HEAD
 1.1.6.2 25-Feb-2013  tls resync with head
 1.1.6.1 13-Jan-2013  tls file getsecs.c was added on branch tls-maxphys on 2013-02-25 00:28:49 +0000
 1.1.2.2 23-Jan-2013  yamt sync with head
 1.1.2.1 13-Jan-2013  yamt file getsecs.c was added on branch yamt-pagecache on 2013-01-23 00:05:53 +0000
 1.2.20.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.7 30-Jun-2019  tsutsui Pull OpenBSD/luna88k board.h to define SX9100 board device addresses.

Also replace magic addresses with macro where appropriate.
 1.6 11-Jan-2014  tsutsui branches: 1.6.30;
Misc KNF and cosmetics.
 1.5 10-Jan-2014  tsutsui Reorgenize boot device configuration. The idea is taken from OpenBSD/luna88k.

- remove kernel-like autoconfiguration to probe bootable devices
- initialize SCSI and Ethernet controllers statically instead
- reorganize device softc structures per autoconf removal
- probe and print all SCSI disks (but don't assign unit numbers)
- make sdopen() to recheck the device and allocate softc dynamically
- use controller number and SCSI target ID (ctlr * 10 + id) to specify
the boot disk on the "boot" command arg
- bump version to denote changes

Now bootloader works as the following:
---
>> NetBSD/luna68k boot, Revision 1.8 (Wed Jan 8 22:13:12 JST 2014)
>> (based on Stinger ver 0.0 [Phase-31])

Machine model = LUNA-II
Physical Memory = 0x4000000 (64 MB)

sc0 at 0xe1000000: async, parity, ID 7
ID 3: TEAC FC-1 HGF 10 rev , 512 bytes/sect x 2879 sectors
ID 6: IBM DPES-31080 rev S31Q, 512 bytes/sect x 2118143 sectors
sc1 at 0xe1000040: async, parity, ID 7
ID 6: MELCO DSC-G rev 1.00, 512 bytes/sect x 62533295 sectors
le0: Am7990 LANCE Ethernet, mem at 0x71010000
le0: Ethernet address = 00:00:0a:03:42:77

Press return to boot now, any other key for boot menu
booting sd(16,0)netbsd - starting in 0 seconds.
auto-boot sd(16,0)netbsd
1911696+96040 [280480+159179]=0x255a30
:
 1.4 03-Jan-2014  tsutsui Misc cleanup from OpenBSD/luna88k.

- remove unused code
- use proper prefix for structure members for readability
 1.3 22-Jan-2013  tsutsui branches: 1.3.2; 1.3.4; 1.3.6;
Whitespace cleanup.
 1.2 20-Jan-2013  tsutsui No need to include <sys/systm.h> in standalone sources.
 1.1 13-Jan-2013  tsutsui Add netboot support.
Based on ews4800mips, mvme68k, and x68k standalone drivers.
Also bump version.

Tested on LUNA-I.

XXX: We really need proper documents about libsa APIs.
 1.3.6.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.3.6.2 25-Feb-2013  tls resync with head
 1.3.6.1 22-Jan-2013  tls file if_le.c was added on branch tls-maxphys on 2013-02-25 00:28:49 +0000
 1.3.4.1 18-May-2014  rmind sync with head
 1.3.2.3 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.3.2.2 23-Jan-2013  yamt sync with head
 1.3.2.1 22-Jan-2013  yamt file if_le.c was added on branch yamt-pagecache on 2013-01-23 00:05:53 +0000
 1.6.30.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.17 24-Sep-2024  rin luna68k: stand: Silence GCC12 -Warray-bounds for main()

- LUNA1_BOOTINFOADDR (0x8c0) is in the 0-th page [0, 0x1000), which
causes -Warray-bounds for GCC12 and later.
- LUNA2_BOOTINFOADDR (0x1d80) is also in the 0-th page, if we switch to
8KB page.

Fix luna68k build with GCC12.
 1.16 14-Feb-2015  tsutsui branches: 1.16.54;
Explicitly denote static functions.
 1.15 21-Apr-2014  tsutsui branches: 1.15.4;
Fix stupid botches in previous.

Use a proper device unit number if a unit number or non-default device
is specified on the boot command.
 1.14 16-Apr-2014  tsutsui Use booted device unit if no unit number is specified on boot command.

Bump version to denote a visible change.
 1.13 11-Jan-2014  tsutsui branches: 1.13.2;
Misc KNF and cosmetics.
 1.12 11-Jan-2014  tsutsui ctually remove all references to obsolete stinger.h.
 1.11 11-Jan-2014  tsutsui Remove unused KernInter stuff.
 1.10 11-Jan-2014  tsutsui Add support to pass boothowto and bootdev info from bootloader to kernel.

Bootloader side changes:
- make boot command parse boothowto flags (-ads etc.)
- pass boothowto and bootdev info to the kernel via %d7 and %d6
as the old 4.4BSD/luna68k kernel expected
- remove unused and now unnecessary "howto" (how_to_boot) command
- export and tweak make_device() in devopen.c to prepare bootdev info
- remove unused and commented out get_boot_device()
 1.9 10-Jan-2014  tsutsui Reorgenize boot device configuration. The idea is taken from OpenBSD/luna88k.

- remove kernel-like autoconfiguration to probe bootable devices
- initialize SCSI and Ethernet controllers statically instead
- reorganize device softc structures per autoconf removal
- probe and print all SCSI disks (but don't assign unit numbers)
- make sdopen() to recheck the device and allocate softc dynamically
- use controller number and SCSI target ID (ctlr * 10 + id) to specify
the boot disk on the "boot" command arg
- bump version to denote changes

Now bootloader works as the following:
---
>> NetBSD/luna68k boot, Revision 1.8 (Wed Jan 8 22:13:12 JST 2014)
>> (based on Stinger ver 0.0 [Phase-31])

Machine model = LUNA-II
Physical Memory = 0x4000000 (64 MB)

sc0 at 0xe1000000: async, parity, ID 7
ID 3: TEAC FC-1 HGF 10 rev , 512 bytes/sect x 2879 sectors
ID 6: IBM DPES-31080 rev S31Q, 512 bytes/sect x 2118143 sectors
sc1 at 0xe1000040: async, parity, ID 7
ID 6: MELCO DSC-G rev 1.00, 512 bytes/sect x 62533295 sectors
le0: Am7990 LANCE Ethernet, mem at 0x71010000
le0: Ethernet address = 00:00:0a:03:42:77

Press return to boot now, any other key for boot menu
booting sd(16,0)netbsd - starting in 0 seconds.
auto-boot sd(16,0)netbsd
1911696+96040 [280480+159179]=0x255a30
:
 1.8 05-Jan-2014  tsutsui Detect boot device on PROM load command and set proper default boot device.

Also remove now unnecessary the old netboot check.

Note all addresses of boot device info set by monitor are checked by
memory dump on several LUNA ROM versions, and these addres might be
different on earlier monitor ROM versions.

Bump version to denote the visible change.
 1.7 03-Jan-2014  tsutsui Pull more fixes from OpenBSD/luna88k:

- Bring getline() - a.k.a libsa gets() with a prompt prefix - in par with libsa
gets(), featurewise; this means support for ^u to clear the input.
- constify
 1.6 05-Mar-2013  tsutsui branches: 1.6.6;
Check netboot and set proper default boot device.
Also bump version.
 1.5 21-Jan-2013  tsutsui branches: 1.5.2; 1.5.6;
Add support for "await key" to abort autoboot and get boot menu.
Also add command help. Bump version.
 1.4 20-Jan-2013  tsutsui No need to include <sys/systm.h> in standalone sources.
 1.3 13-Jan-2013  tsutsui Add netboot support.
Based on ews4800mips, mvme68k, and x68k standalone drivers.
Also bump version.

Tested on LUNA-I.

XXX: We really need proper documents about libsa APIs.
 1.2 12-Jan-2013  tsutsui Check cputype and set machine type (LUNA-I or LUNA-II).
Tested on only LUNA-I for now.
 1.1 05-Jan-2013  tsutsui First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.5.6.5 03-Dec-2017  jdolecek update from HEAD
 1.5.6.4 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.5.6.3 23-Jun-2013  tls resync from head
 1.5.6.2 25-Feb-2013  tls resync with head
 1.5.6.1 21-Jan-2013  tls file init_main.c was added on branch tls-maxphys on 2013-02-25 00:28:49 +0000
 1.5.2.3 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.2.2 23-Jan-2013  yamt sync with head
 1.5.2.1 21-Jan-2013  yamt file init_main.c was added on branch yamt-pagecache on 2013-01-23 00:05:53 +0000
 1.6.6.1 18-May-2014  rmind sync with head
 1.13.2.1 10-Aug-2014  tls Rebase.
 1.15.4.1 06-Apr-2015  skrll Sync with HEAD
 1.16.54.1 02-Aug-2025  perseant Sync with HEAD
 1.6 10-Jan-2014  tsutsui Reorgenize boot device configuration. The idea is taken from OpenBSD/luna88k.

- remove kernel-like autoconfiguration to probe bootable devices
- initialize SCSI and Ethernet controllers statically instead
- reorganize device softc structures per autoconf removal
- probe and print all SCSI disks (but don't assign unit numbers)
- make sdopen() to recheck the device and allocate softc dynamically
- use controller number and SCSI target ID (ctlr * 10 + id) to specify
the boot disk on the "boot" command arg
- bump version to denote changes

Now bootloader works as the following:
---
>> NetBSD/luna68k boot, Revision 1.8 (Wed Jan 8 22:13:12 JST 2014)
>> (based on Stinger ver 0.0 [Phase-31])

Machine model = LUNA-II
Physical Memory = 0x4000000 (64 MB)

sc0 at 0xe1000000: async, parity, ID 7
ID 3: TEAC FC-1 HGF 10 rev , 512 bytes/sect x 2879 sectors
ID 6: IBM DPES-31080 rev S31Q, 512 bytes/sect x 2118143 sectors
sc1 at 0xe1000040: async, parity, ID 7
ID 6: MELCO DSC-G rev 1.00, 512 bytes/sect x 62533295 sectors
le0: Am7990 LANCE Ethernet, mem at 0x71010000
le0: Ethernet address = 00:00:0a:03:42:77

Press return to boot now, any other key for boot menu
booting sd(16,0)netbsd - starting in 0 seconds.
auto-boot sd(16,0)netbsd
1911696+96040 [280480+159179]=0x255a30
:
 1.5 03-Jan-2014  tsutsui Misc cleanup from OpenBSD/luna88k.

- remove unused code
- use proper prefix for structure members for readability
 1.4 03-Jan-2014  tsutsui Remove unused code (from OpenBSD/luna88k). Some KNF.
 1.3 14-Jan-2013  tsutsui branches: 1.3.2; 1.3.4; 1.3.6;
Fix drivers to make secondary SPC SCSI on LUNA-II work properly.
Also bump version.

Now we can load a NetBSD kernel from external SCSI disks on LUNA-II.
(and netboot on LUNA-II also works)
 1.2 13-Jan-2013  tsutsui Add netboot support.
Based on ews4800mips, mvme68k, and x68k standalone drivers.
Also bump version.

Tested on LUNA-I.

XXX: We really need proper documents about libsa APIs.
 1.1 05-Jan-2013  tsutsui First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.3.6.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.3.6.2 25-Feb-2013  tls resync with head
 1.3.6.1 14-Jan-2013  tls file ioconf.c was added on branch tls-maxphys on 2013-02-25 00:28:49 +0000
 1.3.4.1 18-May-2014  rmind sync with head
 1.3.2.3 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.3.2.2 23-Jan-2013  yamt sync with head
 1.3.2.1 14-Jan-2013  yamt file ioconf.c was added on branch yamt-pagecache on 2013-01-23 00:05:54 +0000
 1.5 03-Sep-2021  tsutsui Ignore mouse packets to avoid unexpected data handled as keyboard input.

Patch from moveccr.
 1.4 14-Feb-2015  tsutsui Make local readonly arrays static const.
 1.3 14-Feb-2015  tsutsui Use proper signedness and exact-width interger types.
 1.2 11-Jan-2014  tsutsui branches: 1.2.6;
Misc KNF and cosmetics.
 1.1 05-Jan-2013  tsutsui branches: 1.1.2; 1.1.4; 1.1.6;
First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.1.6.4 03-Dec-2017  jdolecek update from HEAD
 1.1.6.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.6.2 25-Feb-2013  tls resync with head
 1.1.6.1 05-Jan-2013  tls file kbd.c was added on branch tls-maxphys on 2013-02-25 00:28:49 +0000
 1.1.4.1 18-May-2014  rmind sync with head
 1.1.2.3 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.2.2 23-Jan-2013  yamt sync with head
 1.1.2.1 05-Jan-2013  yamt file kbd.c was added on branch yamt-pagecache on 2013-01-23 00:05:54 +0000
 1.2.6.1 06-Apr-2015  skrll Sync with HEAD
 1.2 11-Jan-2014  tsutsui Misc KNF and cosmetics.
 1.1 05-Jan-2013  tsutsui branches: 1.1.2; 1.1.4; 1.1.6;
First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.1.6.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.6.2 25-Feb-2013  tls resync with head
 1.1.6.1 05-Jan-2013  tls file kbdreg.h was added on branch tls-maxphys on 2013-02-25 00:28:49 +0000
 1.1.4.1 18-May-2014  rmind sync with head
 1.1.2.3 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.2.2 23-Jan-2013  yamt sync with head
 1.1.2.1 05-Jan-2013  yamt file kbdreg.h was added on branch yamt-pagecache on 2013-01-23 00:05:54 +0000
 1.5 05-Dec-2021  msaitoh s/initialz/initializ/ in comment.
 1.4 04-Sep-2018  riastradh Fix some min/max -> uimin/uimax stragglers.

Confirmed by the 2018-09-04T04:40Z autobuild.
 1.3 16-Apr-2014  tsutsui branches: 1.3.26; 1.3.28;
Appease gcc 4.8 -Wunused-but-set-variable warnings.
 1.2 11-Jan-2014  tsutsui branches: 1.2.2;
Misc KNF and cosmetics.
 1.1 13-Jan-2013  tsutsui branches: 1.1.2; 1.1.4; 1.1.6;
Add netboot support.
Based on ews4800mips, mvme68k, and x68k standalone drivers.
Also bump version.

Tested on LUNA-I.

XXX: We really need proper documents about libsa APIs.
 1.1.6.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.6.2 25-Feb-2013  tls resync with head
 1.1.6.1 13-Jan-2013  tls file lance.c was added on branch tls-maxphys on 2013-02-25 00:28:49 +0000
 1.1.4.1 18-May-2014  rmind sync with head
 1.1.2.3 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.2.2 23-Jan-2013  yamt sync with head
 1.1.2.1 13-Jan-2013  yamt file lance.c was added on branch yamt-pagecache on 2013-01-23 00:05:54 +0000
 1.2.2.1 10-Aug-2014  tls Rebase.
 1.3.28.1 10-Jun-2019  christos Sync with HEAD
 1.3.26.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.1 13-Jan-2013  tsutsui branches: 1.1.2; 1.1.6;
Add netboot support.
Based on ews4800mips, mvme68k, and x68k standalone drivers.
Also bump version.

Tested on LUNA-I.

XXX: We really need proper documents about libsa APIs.
 1.1.6.2 25-Feb-2013  tls resync with head
 1.1.6.1 13-Jan-2013  tls file lance.h was added on branch tls-maxphys on 2013-02-25 00:28:49 +0000
 1.1.2.2 23-Jan-2013  yamt sync with head
 1.1.2.1 13-Jan-2013  yamt file lance.h was added on branch yamt-pagecache on 2013-01-23 00:05:54 +0000
 1.15 16-Mar-2022  andvar s/paniced/panicked/ and s/borken/broken/ in comments.
 1.14 28-Sep-2018  isaki Improve codes. No functional changes intended.
Confirmed on LUNA-I. OK'ed by tsutsui@.
 1.13 28-Sep-2018  isaki Remove unused variable.
OK'ed by tsutsui@.
 1.12 28-Sep-2018  isaki Fix a wrong comment.
 1.11 24-Mar-2014  martin branches: 1.11.28; 1.11.30;
PR port-luna68k/48677: fix some typos.
From shinnashi takeshi.
 1.10 11-Jan-2014  tsutsui Misc KNF and cosmetics.
 1.9 22-Jan-2013  tsutsui branches: 1.9.2; 1.9.4; 1.9.6;
Whitespace cleanup.
 1.8 21-Jan-2013  tsutsui Add support for "await key" to abort autoboot and get boot menu.
Also add command help. Bump version.
 1.7 20-Jan-2013  tsutsui Use hex value rather than decimal for register and device macro.
 1.6 20-Jan-2013  tsutsui Add RCS Id.
 1.5 20-Jan-2013  tsutsui Specify text address via Makefile rather than hardcoding in boot.ldscript.
 1.4 13-Jan-2013  tsutsui Add netboot support.
Based on ews4800mips, mvme68k, and x68k standalone drivers.
Also bump version.

Tested on LUNA-I.

XXX: We really need proper documents about libsa APIs.
 1.3 12-Jan-2013  tsutsui Check cputype and set machine type (LUNA-I or LUNA-II).
Tested on only LUNA-I for now.
 1.2 10-Jan-2013  tsutsui Use proper asm symbol macro.
 1.1 05-Jan-2013  tsutsui First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.9.6.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.9.6.2 25-Feb-2013  tls resync with head
 1.9.6.1 22-Jan-2013  tls file locore.S was added on branch tls-maxphys on 2013-02-25 00:28:49 +0000
 1.9.4.1 18-May-2014  rmind sync with head
 1.9.2.3 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.9.2.2 23-Jan-2013  yamt sync with head
 1.9.2.1 22-Jan-2013  yamt file locore.S was added on branch yamt-pagecache on 2013-01-23 00:05:54 +0000
 1.11.30.1 10-Jun-2019  christos Sync with HEAD
 1.11.28.1 30-Sep-2018  pgoyette Ssync with HEAD
 1.1 16-Jan-2013  tsutsui branches: 1.1.2; 1.1.6;
Enable and add ls command for ufs.
 1.1.6.2 25-Feb-2013  tls resync with head
 1.1.6.1 16-Jan-2013  tls file ls.c was added on branch tls-maxphys on 2013-02-25 00:28:49 +0000
 1.1.2.2 23-Jan-2013  yamt sync with head
 1.1.2.1 16-Jan-2013  yamt file ls.c was added on branch yamt-pagecache on 2013-01-23 00:05:54 +0000
 1.9 25-Sep-2024  rin luna68k/boot: Silence GCC12 -Warray-bounds for regdump()

Dereference to `(int *)(&rp) - 1` (SR in H/W exception frame) is
blamed by GCC12 and later. Just silence as done for m68k/regdump.c.

Finally fix luna68k build.
 1.8 27-Oct-2019  martin branches: 1.8.32;
Back out previous - fixed differently by rin already.
 1.7 27-Oct-2019  martin Define _KERNEL while including reg.h: we need the (now protected) register
names.
 1.6 06-Apr-2019  thorpej Overhaul the API used to fetch and store individual memory cells in
userspace. The old fetch(9) and store(9) APIs (fubyte(), fuword(),
subyte(), suword(), etc.) are retired and replaced with new ufetch(9)
and ustore(9) APIs that can return proper error codes, etc. and are
implemented consistently across all platforms. The interrupt-safe
variants are no longer supported (and several of the existing attempts
at fuswintr(), etc. were buggy and not actually interrupt-safe).

Also augmement the ucas(9) API, making it consistently available on
all plaforms, supporting uniprocessor and multiprocessor systems, even
those that do not have CAS or LL/SC primitives.

Welcome to NetBSD 8.99.37.
 1.5 14-Feb-2015  tsutsui branches: 1.5.18;
Explicitly denote static functions.
 1.4 14-Feb-2015  tsutsui Misc KNF and cosmetics.
 1.3 16-Apr-2014  tsutsui branches: 1.3.4;
Appease gcc 4.8 -Wunused-but-set-variable warnings.
 1.2 11-Jan-2014  tsutsui branches: 1.2.2;
Misc KNF and cosmetics.
 1.1 05-Jan-2013  tsutsui branches: 1.1.2; 1.1.4; 1.1.6;
First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.1.6.4 03-Dec-2017  jdolecek update from HEAD
 1.1.6.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.6.2 25-Feb-2013  tls resync with head
 1.1.6.1 05-Jan-2013  tls file machdep.c was added on branch tls-maxphys on 2013-02-25 00:28:49 +0000
 1.1.4.1 18-May-2014  rmind sync with head
 1.1.2.3 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.2.2 23-Jan-2013  yamt sync with head
 1.1.2.1 05-Jan-2013  yamt file machdep.c was added on branch yamt-pagecache on 2013-01-23 00:05:54 +0000
 1.2.2.1 10-Aug-2014  tls Rebase.
 1.3.4.1 06-Apr-2015  skrll Sync with HEAD
 1.5.18.1 10-Jun-2019  christos Sync with HEAD
 1.8.32.1 02-Aug-2025  perseant Sync with HEAD
 1.4 11-Jan-2014  tsutsui Misc KNF and cosmetics.
 1.3 22-Jan-2013  tsutsui branches: 1.3.2; 1.3.4; 1.3.6;
Whitespace cleanup.
 1.2 10-Jan-2013  tsutsui Make "disklabel" command print correct disklabel info.
- use exact-width interger types to define on-disk format
(daddr_t could be a different size)
- use proper LABELOFFSET to locate BSD disklabel
(LABELOFFSET for luna68k is 64 as 4.4BSD-Lite2 while other
ports that use sun_disklabel use 128)
 1.1 05-Jan-2013  tsutsui First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.3.6.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.3.6.2 25-Feb-2013  tls resync with head
 1.3.6.1 22-Jan-2013  tls file omron_disklabel.h was added on branch tls-maxphys on 2013-02-25 00:28:49 +0000
 1.3.4.1 18-May-2014  rmind sync with head
 1.3.2.3 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.3.2.2 23-Jan-2013  yamt sync with head
 1.3.2.1 22-Jan-2013  yamt file omron_disklabel.h was added on branch yamt-pagecache on 2013-01-23 00:05:54 +0000
 1.8 25-Nov-2016  tsutsui Add a missing newline in help message.
 1.7 14-Feb-2015  tsutsui branches: 1.7.2;
Make local readonly arrays static const.
 1.6 11-Jan-2014  tsutsui branches: 1.6.6;
Misc KNF and cosmetics.
 1.5 11-Jan-2014  tsutsui Add support to pass boothowto and bootdev info from bootloader to kernel.

Bootloader side changes:
- make boot command parse boothowto flags (-ads etc.)
- pass boothowto and bootdev info to the kernel via %d7 and %d6
as the old 4.4BSD/luna68k kernel expected
- remove unused and now unnecessary "howto" (how_to_boot) command
- export and tweak make_device() in devopen.c to prepare bootdev info
- remove unused and commented out get_boot_device()
 1.4 22-Jan-2013  tsutsui branches: 1.4.2; 1.4.4; 1.4.6;
Whitespace cleanup.
 1.3 21-Jan-2013  tsutsui Add support for "await key" to abort autoboot and get boot menu.
Also add command help. Bump version.
 1.2 16-Jan-2013  tsutsui Enable and add ls command for ufs.
 1.1 05-Jan-2013  tsutsui First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.4.6.4 03-Dec-2017  jdolecek update from HEAD
 1.4.6.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.4.6.2 25-Feb-2013  tls resync with head
 1.4.6.1 22-Jan-2013  tls file parse.c was added on branch tls-maxphys on 2013-02-25 00:28:49 +0000
 1.4.4.1 18-May-2014  rmind sync with head
 1.4.2.3 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.4.2.2 23-Jan-2013  yamt sync with head
 1.4.2.1 22-Jan-2013  yamt file parse.c was added on branch yamt-pagecache on 2013-01-23 00:05:54 +0000
 1.6.6.2 05-Dec-2016  skrll Sync with HEAD
 1.6.6.1 06-Apr-2015  skrll Sync with HEAD
 1.7.2.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.3 24-Mar-2014  martin PR port-luna68k/48677: fix some typos.
From shinnashi takeshi.
 1.2 11-Jan-2014  tsutsui Misc KNF and cosmetics.
 1.1 05-Jan-2013  tsutsui branches: 1.1.2; 1.1.4; 1.1.6;
First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.1.6.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.6.2 25-Feb-2013  tls resync with head
 1.1.6.1 05-Jan-2013  tls file preset.h was added on branch tls-maxphys on 2013-02-25 00:28:49 +0000
 1.1.4.1 18-May-2014  rmind sync with head
 1.1.2.3 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.2.2 23-Jan-2013  yamt sync with head
 1.1.2.1 05-Jan-2013  yamt file preset.h was added on branch yamt-pagecache on 2013-01-23 00:05:54 +0000
 1.3 22-Jan-2013  tsutsui branches: 1.3.2; 1.3.6;
Whitespace cleanup.
 1.2 21-Jan-2013  tsutsui Add support for "await key" to abort autoboot and get boot menu.
Also add command help. Bump version.
 1.1 05-Jan-2013  tsutsui First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.3.6.2 25-Feb-2013  tls resync with head
 1.3.6.1 22-Jan-2013  tls file prf.c was added on branch tls-maxphys on 2013-02-25 00:28:49 +0000
 1.3.2.3 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.3.2.2 23-Jan-2013  yamt sync with head
 1.3.2.1 22-Jan-2013  yamt file prf.c was added on branch yamt-pagecache on 2013-01-23 00:05:54 +0000
 1.3 14-Feb-2015  tsutsui Use proper signedness and exact-width interger types.
 1.2 11-Jan-2014  tsutsui branches: 1.2.6;
Misc KNF and cosmetics.
 1.1 05-Jan-2013  tsutsui branches: 1.1.2; 1.1.4; 1.1.6;
First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.1.6.4 03-Dec-2017  jdolecek update from HEAD
 1.1.6.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.6.2 25-Feb-2013  tls resync with head
 1.1.6.1 05-Jan-2013  tls file rcvbuf.h was added on branch tls-maxphys on 2013-02-25 00:28:49 +0000
 1.1.4.1 18-May-2014  rmind sync with head
 1.1.2.3 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.2.2 23-Jan-2013  yamt sync with head
 1.1.2.1 05-Jan-2013  yamt file rcvbuf.h was added on branch yamt-pagecache on 2013-01-23 00:05:54 +0000
 1.2.6.1 06-Apr-2015  skrll Sync with HEAD
 1.2 11-Jan-2014  tsutsui Misc KNF and cosmetics.
 1.1 05-Jan-2013  tsutsui branches: 1.1.2; 1.1.4; 1.1.6;
First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.1.6.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.6.2 25-Feb-2013  tls resync with head
 1.1.6.1 05-Jan-2013  tls file romcons.c was added on branch tls-maxphys on 2013-02-25 00:28:49 +0000
 1.1.4.1 18-May-2014  rmind sync with head
 1.1.2.3 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.2.2 23-Jan-2013  yamt sync with head
 1.1.2.1 05-Jan-2013  yamt file romcons.c was added on branch yamt-pagecache on 2013-01-23 00:05:54 +0000
 1.1 05-Jan-2013  tsutsui branches: 1.1.2; 1.1.6;
First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.1.6.2 25-Feb-2013  tls resync with head
 1.1.6.1 05-Jan-2013  tls file romvec.h was added on branch tls-maxphys on 2013-02-25 00:28:49 +0000
 1.1.2.2 23-Jan-2013  yamt sync with head
 1.1.2.1 05-Jan-2013  yamt file romvec.h was added on branch yamt-pagecache on 2013-01-23 00:05:54 +0000
 1.20 14-Feb-2015  tsutsui Use proper signedness and exact-width interger types.
 1.19 21-Apr-2014  tsutsui branches: 1.19.4;
Fix stupid botches in previous.

Use a proper device unit number if a unit number or non-default device
is specified on the boot command.
 1.18 16-Apr-2014  tsutsui Use booted device unit if no unit number is specified on boot command.

Bump version to denote a visible change.
 1.17 11-Jan-2014  tsutsui branches: 1.17.2;
Remove unused declarations.
 1.16 11-Jan-2014  tsutsui Add support to pass boothowto and bootdev info from bootloader to kernel.

Bootloader side changes:
- make boot command parse boothowto flags (-ads etc.)
- pass boothowto and bootdev info to the kernel via %d7 and %d6
as the old 4.4BSD/luna68k kernel expected
- remove unused and now unnecessary "howto" (how_to_boot) command
- export and tweak make_device() in devopen.c to prepare bootdev info
- remove unused and commented out get_boot_device()
 1.15 10-Jan-2014  tsutsui Reorgenize boot device configuration. The idea is taken from OpenBSD/luna88k.

- remove kernel-like autoconfiguration to probe bootable devices
- initialize SCSI and Ethernet controllers statically instead
- reorganize device softc structures per autoconf removal
- probe and print all SCSI disks (but don't assign unit numbers)
- make sdopen() to recheck the device and allocate softc dynamically
- use controller number and SCSI target ID (ctlr * 10 + id) to specify
the boot disk on the "boot" command arg
- bump version to denote changes

Now bootloader works as the following:
---
>> NetBSD/luna68k boot, Revision 1.8 (Wed Jan 8 22:13:12 JST 2014)
>> (based on Stinger ver 0.0 [Phase-31])

Machine model = LUNA-II
Physical Memory = 0x4000000 (64 MB)

sc0 at 0xe1000000: async, parity, ID 7
ID 3: TEAC FC-1 HGF 10 rev , 512 bytes/sect x 2879 sectors
ID 6: IBM DPES-31080 rev S31Q, 512 bytes/sect x 2118143 sectors
sc1 at 0xe1000040: async, parity, ID 7
ID 6: MELCO DSC-G rev 1.00, 512 bytes/sect x 62533295 sectors
le0: Am7990 LANCE Ethernet, mem at 0x71010000
le0: Ethernet address = 00:00:0a:03:42:77

Press return to boot now, any other key for boot menu
booting sd(16,0)netbsd - starting in 0 seconds.
auto-boot sd(16,0)netbsd
1911696+96040 [280480+159179]=0x255a30
:
 1.14 03-Jan-2014  tsutsui Pull more cleanups from OpenBSD/luna88k:

- remove unused declarations
- rename struct scsi_fmt_cdb to scsi_generic_cdb
 1.13 03-Jan-2014  tsutsui Pull more fixes from OpenBSD/luna88k:

- Bring getline() - a.k.a libsa gets() with a prompt prefix - in par with libsa
gets(), featurewise; this means support for ^u to clear the input.
- constify
 1.12 03-Jan-2014  tsutsui Pull more fixes from OpenBSD/luna88k:

- accept empty controller and partition numbers, as well as empty filenames,
and use defaults (0, 0 and "netbsd") instead of complaining the boot path
is invalid
- move a macro where actually necessary

Also bump version to denote the user visible change.
 1.11 02-Jan-2014  tsutsui Misc cleanup. Mostly from OpenBSD/luna88k.

- fix isprint() macro
- hight -> height
- remove an unused function
- adjust tabs/spaces
- constify the bitmap font
- consistently use #define<space>
- use #if 0/#endif to disable code block
- u_long -> uint32_t, u_short -> uint16_t
- some KNF
 1.10 05-Mar-2013  tsutsui branches: 1.10.6;
Check netboot and set proper default boot device.
Also bump version.
 1.9 22-Jan-2013  tsutsui branches: 1.9.2; 1.9.6;
Whitespace cleanup.
 1.8 21-Jan-2013  tsutsui Add support for "await key" to abort autoboot and get boot menu.
Also add command help. Bump version.
 1.7 20-Jan-2013  tsutsui Remove unused bmcintr() function.
 1.6 16-Jan-2013  tsutsui Add UFS2 support. Also bump version.
 1.5 16-Jan-2013  tsutsui Enable and add ls command for ufs.
 1.4 14-Jan-2013  tsutsui Fix drivers to make secondary SPC SCSI on LUNA-II work properly.
Also bump version.

Now we can load a NetBSD kernel from external SCSI disks on LUNA-II.
(and netboot on LUNA-II also works)
 1.3 13-Jan-2013  tsutsui Add netboot support.
Based on ews4800mips, mvme68k, and x68k standalone drivers.
Also bump version.

Tested on LUNA-I.

XXX: We really need proper documents about libsa APIs.
 1.2 12-Jan-2013  tsutsui Check cputype and set machine type (LUNA-I or LUNA-II).
Tested on only LUNA-I for now.
 1.1 05-Jan-2013  tsutsui First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.9.6.5 03-Dec-2017  jdolecek update from HEAD
 1.9.6.4 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.9.6.3 23-Jun-2013  tls resync from head
 1.9.6.2 25-Feb-2013  tls resync with head
 1.9.6.1 22-Jan-2013  tls file samachdep.h was added on branch tls-maxphys on 2013-02-25 00:28:49 +0000
 1.9.2.3 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.9.2.2 23-Jan-2013  yamt sync with head
 1.9.2.1 22-Jan-2013  yamt file samachdep.h was added on branch yamt-pagecache on 2013-01-23 00:05:54 +0000
 1.10.6.1 18-May-2014  rmind sync with head
 1.17.2.1 10-Aug-2014  tls Rebase.
 1.19.4.1 06-Apr-2015  skrll Sync with HEAD
 1.20 25-Sep-2024  rin luna68k/boot: XXX: Silence GCC12 -Warray-bounds for scident()

sensebuf and inqbuf may be uninitialized for some cases.

Real fix should be to check return values everywhere in
scsi_request_sense(), scsi_immed_command(), and functions
called from them.
 1.19 10-Dec-2021  andvar branches: 1.19.10;
s/occured/occurred/ in comments, log messages and man pages.
 1.18 15-Jun-2021  tsutsui Fix off-by-one of a number of blocks of probed disks.

The SCSI READ_CAPACITY command returns the last logical data block
address, so we have to increment it to get a number of blocks
as src/sys/dev/scsipi/sd.c does.

Bump revision to denote the change.
 1.17 09-Feb-2018  jakllsch branches: 1.17.20;
Explain what may seem to be a non-sensical assignment, but isn't.

closes PR 53000
 1.16 31-Oct-2017  christos undo - pointed out this is a register assignment.
 1.15 31-Oct-2017  christos PR/52680: David Binderman: Remove dedundant assignment.
 1.14 14-Feb-2015  tsutsui Explicitly denote static functions.
 1.13 14-Feb-2015  tsutsui Misc KNF and cosmetics.
 1.12 14-Feb-2015  tsutsui Use proper signedness and exact-width interger types.
 1.11 16-Apr-2014  tsutsui branches: 1.11.4;
Appease gcc 4.8 -Wunused-but-set-variable warnings.
 1.10 11-Jan-2014  tsutsui branches: 1.10.2;
Misc KNF and cosmetics.
 1.9 10-Jan-2014  tsutsui Reorgenize boot device configuration. The idea is taken from OpenBSD/luna88k.

- remove kernel-like autoconfiguration to probe bootable devices
- initialize SCSI and Ethernet controllers statically instead
- reorganize device softc structures per autoconf removal
- probe and print all SCSI disks (but don't assign unit numbers)
- make sdopen() to recheck the device and allocate softc dynamically
- use controller number and SCSI target ID (ctlr * 10 + id) to specify
the boot disk on the "boot" command arg
- bump version to denote changes

Now bootloader works as the following:
---
>> NetBSD/luna68k boot, Revision 1.8 (Wed Jan 8 22:13:12 JST 2014)
>> (based on Stinger ver 0.0 [Phase-31])

Machine model = LUNA-II
Physical Memory = 0x4000000 (64 MB)

sc0 at 0xe1000000: async, parity, ID 7
ID 3: TEAC FC-1 HGF 10 rev , 512 bytes/sect x 2879 sectors
ID 6: IBM DPES-31080 rev S31Q, 512 bytes/sect x 2118143 sectors
sc1 at 0xe1000040: async, parity, ID 7
ID 6: MELCO DSC-G rev 1.00, 512 bytes/sect x 62533295 sectors
le0: Am7990 LANCE Ethernet, mem at 0x71010000
le0: Ethernet address = 00:00:0a:03:42:77

Press return to boot now, any other key for boot menu
booting sd(16,0)netbsd - starting in 0 seconds.
auto-boot sd(16,0)netbsd
1911696+96040 [280480+159179]=0x255a30
:
 1.8 03-Jan-2014  tsutsui Pull more cleanups from OpenBSD/luna88k:

- remove unused declarations
- rename struct scsi_fmt_cdb to scsi_generic_cdb
 1.7 02-Jan-2014  tsutsui Replace broken (by SCCS) ISO-2022-JP comments with UTF-8.

Recovered and decoded by isaki@.
 1.6 02-Jan-2014  tsutsui Add bound check of a controller number in scrun().

Noticed by miod@openbsd.
 1.5 02-Jan-2014  tsutsui Change the SCSI select timeout from 2ms to 250ms as kernel spc(4) driver does.

Noticed by miod@openbsd.
 1.4 22-Jan-2013  tsutsui branches: 1.4.2; 1.4.4; 1.4.6;
Whitespace cleanup.
 1.3 14-Jan-2013  tsutsui Fix drivers to make secondary SPC SCSI on LUNA-II work properly.
Also bump version.

Now we can load a NetBSD kernel from external SCSI disks on LUNA-II.
(and netboot on LUNA-II also works)
 1.2 13-Jan-2013  tsutsui Remove unused function members from struct driver.
This makes adding other drivers easier.
 1.1 05-Jan-2013  tsutsui First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.4.6.4 03-Dec-2017  jdolecek update from HEAD
 1.4.6.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.4.6.2 25-Feb-2013  tls resync with head
 1.4.6.1 22-Jan-2013  tls file sc.c was added on branch tls-maxphys on 2013-02-25 00:28:49 +0000
 1.4.4.1 18-May-2014  rmind sync with head
 1.4.2.3 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.4.2.2 23-Jan-2013  yamt sync with head
 1.4.2.1 22-Jan-2013  yamt file sc.c was added on branch yamt-pagecache on 2013-01-23 00:05:54 +0000
 1.10.2.1 10-Aug-2014  tls Rebase.
 1.11.4.1 06-Apr-2015  skrll Sync with HEAD
 1.17.20.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.19.10.1 02-Aug-2025  perseant Sync with HEAD
 1.2 11-Jan-2014  tsutsui Misc KNF and cosmetics.
 1.1 05-Jan-2013  tsutsui branches: 1.1.2; 1.1.4; 1.1.6;
First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.1.6.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.6.2 25-Feb-2013  tls resync with head
 1.1.6.1 05-Jan-2013  tls file screen.c was added on branch tls-maxphys on 2013-02-25 00:28:49 +0000
 1.1.4.1 18-May-2014  rmind sync with head
 1.1.2.3 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.2.2 23-Jan-2013  yamt sync with head
 1.1.2.1 05-Jan-2013  yamt file screen.c was added on branch yamt-pagecache on 2013-01-23 00:05:54 +0000
 1.8 05-Jul-2024  andvar s/vender/vendor/ in comments, log message and fw ohci register property.
 1.7 14-Feb-2015  tsutsui branches: 1.7.54;
Misc KNF and cosmetics.
 1.6 14-Feb-2015  tsutsui Use proper signedness and exact-width interger types.
 1.5 11-Jan-2014  tsutsui branches: 1.5.6;
Misc KNF and cosmetics.
 1.4 03-Jan-2014  tsutsui Pull more cleanups from OpenBSD/luna88k:

- remove unused declarations
- rename struct scsi_fmt_cdb to scsi_generic_cdb
 1.3 02-Jan-2014  tsutsui Replace broken (by SCCS) ISO-2022-JP comments with UTF-8.

Recovered and decoded by isaki@.
 1.2 20-Jan-2013  tsutsui branches: 1.2.2; 1.2.4; 1.2.6;
Don't call internal cngetc() and cnputc() directly.
Use public getchar() and putchar() instead.
 1.1 05-Jan-2013  tsutsui First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.2.6.4 03-Dec-2017  jdolecek update from HEAD
 1.2.6.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2.6.2 25-Feb-2013  tls resync with head
 1.2.6.1 20-Jan-2013  tls file scsi.c was added on branch tls-maxphys on 2013-02-25 00:28:49 +0000
 1.2.4.1 18-May-2014  rmind sync with head
 1.2.2.3 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.2.2 23-Jan-2013  yamt sync with head
 1.2.2.1 20-Jan-2013  yamt file scsi.c was added on branch yamt-pagecache on 2013-01-23 00:05:54 +0000
 1.5.6.1 06-Apr-2015  skrll Sync with HEAD
 1.7.54.1 02-Aug-2025  perseant Sync with HEAD
 1.4 14-Feb-2015  tsutsui Use proper signedness and exact-width interger types.
 1.3 03-Jan-2014  tsutsui branches: 1.3.6;
Pull more cleanups from OpenBSD/luna88k:

- remove unused declarations
- rename struct scsi_fmt_cdb to scsi_generic_cdb
 1.2 22-Jan-2013  tsutsui branches: 1.2.2; 1.2.4; 1.2.6;
Whitespace cleanup.
 1.1 05-Jan-2013  tsutsui First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.2.6.4 03-Dec-2017  jdolecek update from HEAD
 1.2.6.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2.6.2 25-Feb-2013  tls resync with head
 1.2.6.1 22-Jan-2013  tls file scsireg.h was added on branch tls-maxphys on 2013-02-25 00:28:49 +0000
 1.2.4.1 18-May-2014  rmind sync with head
 1.2.2.3 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.2.2 23-Jan-2013  yamt sync with head
 1.2.2.1 22-Jan-2013  yamt file scsireg.h was added on branch yamt-pagecache on 2013-01-23 00:05:54 +0000
 1.3.6.1 06-Apr-2015  skrll Sync with HEAD
 1.4 02-Aug-2021  andvar fix various typos in comments and log messages.
 1.3 14-Feb-2015  tsutsui Use proper signedness and exact-width interger types.
 1.2 10-Jan-2014  tsutsui branches: 1.2.6;
Reorgenize boot device configuration. The idea is taken from OpenBSD/luna88k.

- remove kernel-like autoconfiguration to probe bootable devices
- initialize SCSI and Ethernet controllers statically instead
- reorganize device softc structures per autoconf removal
- probe and print all SCSI disks (but don't assign unit numbers)
- make sdopen() to recheck the device and allocate softc dynamically
- use controller number and SCSI target ID (ctlr * 10 + id) to specify
the boot disk on the "boot" command arg
- bump version to denote changes

Now bootloader works as the following:
---
>> NetBSD/luna68k boot, Revision 1.8 (Wed Jan 8 22:13:12 JST 2014)
>> (based on Stinger ver 0.0 [Phase-31])

Machine model = LUNA-II
Physical Memory = 0x4000000 (64 MB)

sc0 at 0xe1000000: async, parity, ID 7
ID 3: TEAC FC-1 HGF 10 rev , 512 bytes/sect x 2879 sectors
ID 6: IBM DPES-31080 rev S31Q, 512 bytes/sect x 2118143 sectors
sc1 at 0xe1000040: async, parity, ID 7
ID 6: MELCO DSC-G rev 1.00, 512 bytes/sect x 62533295 sectors
le0: Am7990 LANCE Ethernet, mem at 0x71010000
le0: Ethernet address = 00:00:0a:03:42:77

Press return to boot now, any other key for boot menu
booting sd(16,0)netbsd - starting in 0 seconds.
auto-boot sd(16,0)netbsd
1911696+96040 [280480+159179]=0x255a30
:
 1.1 05-Jan-2013  tsutsui branches: 1.1.2; 1.1.4; 1.1.6;
First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.1.6.4 03-Dec-2017  jdolecek update from HEAD
 1.1.6.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.6.2 25-Feb-2013  tls resync with head
 1.1.6.1 05-Jan-2013  tls file scsivar.h was added on branch tls-maxphys on 2013-02-25 00:28:49 +0000
 1.1.4.1 18-May-2014  rmind sync with head
 1.1.2.3 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.2.2 23-Jan-2013  yamt sync with head
 1.1.2.1 05-Jan-2013  yamt file scsivar.h was added on branch yamt-pagecache on 2013-01-23 00:05:54 +0000
 1.2.6.1 06-Apr-2015  skrll Sync with HEAD
 1.13 24-Jun-2023  tsutsui Fix a wrong cdb size of SCSI disk write command. From OpenBSD/luna88k.
 1.12 14-Feb-2015  tsutsui Explicitly denote static functions.
 1.11 16-Apr-2014  tsutsui branches: 1.11.4;
Check a status code and return proper errno in sdstrategy().

Suggested by gcc 4.8 -Wunused-but-set-variable warning to use the variable.
 1.10 11-Jan-2014  tsutsui branches: 1.10.2;
Misc KNF and cosmetics.
 1.9 10-Jan-2014  tsutsui Reorgenize boot device configuration. The idea is taken from OpenBSD/luna88k.

- remove kernel-like autoconfiguration to probe bootable devices
- initialize SCSI and Ethernet controllers statically instead
- reorganize device softc structures per autoconf removal
- probe and print all SCSI disks (but don't assign unit numbers)
- make sdopen() to recheck the device and allocate softc dynamically
- use controller number and SCSI target ID (ctlr * 10 + id) to specify
the boot disk on the "boot" command arg
- bump version to denote changes

Now bootloader works as the following:
---
>> NetBSD/luna68k boot, Revision 1.8 (Wed Jan 8 22:13:12 JST 2014)
>> (based on Stinger ver 0.0 [Phase-31])

Machine model = LUNA-II
Physical Memory = 0x4000000 (64 MB)

sc0 at 0xe1000000: async, parity, ID 7
ID 3: TEAC FC-1 HGF 10 rev , 512 bytes/sect x 2879 sectors
ID 6: IBM DPES-31080 rev S31Q, 512 bytes/sect x 2118143 sectors
sc1 at 0xe1000040: async, parity, ID 7
ID 6: MELCO DSC-G rev 1.00, 512 bytes/sect x 62533295 sectors
le0: Am7990 LANCE Ethernet, mem at 0x71010000
le0: Ethernet address = 00:00:0a:03:42:77

Press return to boot now, any other key for boot menu
booting sd(16,0)netbsd - starting in 0 seconds.
auto-boot sd(16,0)netbsd
1911696+96040 [280480+159179]=0x255a30
:
 1.8 03-Jan-2014  tsutsui Pull more cleanups from OpenBSD/luna88k:

- remove unused declarations
- rename struct scsi_fmt_cdb to scsi_generic_cdb
 1.7 03-Jan-2014  tsutsui Misc cleanup from OpenBSD/luna88k.

- remove unused code
- use proper prefix for structure members for readability
 1.6 03-Jan-2014  tsutsui Remove unused code (from OpenBSD/luna88k). Some KNF.
 1.5 22-Jan-2013  tsutsui branches: 1.5.2; 1.5.4; 1.5.6;
Whitespace cleanup.
 1.4 21-Jan-2013  tsutsui Slightly modify sd attach message, as kernel does.

before:
sd0: HITACHI DK315C-14 rev H7H6, 2807459 512 byte blocks

after:
sd0: HITACHI DK315C-14 rev H7H6, 512 bytes/sect x 2807459 sectors
 1.3 14-Jan-2013  tsutsui Fix drivers to make secondary SPC SCSI on LUNA-II work properly.
Also bump version.

Now we can load a NetBSD kernel from external SCSI disks on LUNA-II.
(and netboot on LUNA-II also works)
 1.2 13-Jan-2013  tsutsui Remove unused function members from struct driver.
This makes adding other drivers easier.
 1.1 05-Jan-2013  tsutsui First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.5.6.4 03-Dec-2017  jdolecek update from HEAD
 1.5.6.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.5.6.2 25-Feb-2013  tls resync with head
 1.5.6.1 22-Jan-2013  tls file sd.c was added on branch tls-maxphys on 2013-02-25 00:28:50 +0000
 1.5.4.1 18-May-2014  rmind sync with head
 1.5.2.3 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.2.2 23-Jan-2013  yamt sync with head
 1.5.2.1 22-Jan-2013  yamt file sd.c was added on branch yamt-pagecache on 2013-01-23 00:05:54 +0000
 1.10.2.1 10-Aug-2014  tls Rebase.
 1.11.4.1 06-Apr-2015  skrll Sync with HEAD
 1.5 30-Jun-2019  tsutsui Pull OpenBSD/luna88k board.h to define SX9100 board device addresses.

Also replace magic addresses with macro where appropriate.
 1.4 03-Jan-2014  tsutsui branches: 1.4.30;
Remove unused code (from OpenBSD/luna88k). Some KNF.
 1.3 21-Jan-2013  tsutsui branches: 1.3.2; 1.3.4; 1.3.6;
Add support for "await key" to abort autoboot and get boot menu.
Also add command help. Bump version.
 1.2 12-Jan-2013  tsutsui Make sure to enable DTR and RTS on TX initialization for SIO console.
 1.1 05-Jan-2013  tsutsui First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.3.6.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.3.6.2 25-Feb-2013  tls resync with head
 1.3.6.1 21-Jan-2013  tls file sio.c was added on branch tls-maxphys on 2013-02-25 00:28:50 +0000
 1.3.4.1 18-May-2014  rmind sync with head
 1.3.2.3 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.3.2.2 23-Jan-2013  yamt sync with head
 1.3.2.1 21-Jan-2013  yamt file sio.c was added on branch yamt-pagecache on 2013-01-23 00:05:54 +0000
 1.4.30.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.6 24-Jun-2023  tsutsui Add comments and remove nonexistent status registers.
 1.5 28-Mar-2023  andvar s/interrput/interrupt/ and s/accesss/access/ in comments.
 1.4 14-Feb-2015  tsutsui Use proper signedness and exact-width interger types.
 1.3 11-Jan-2014  tsutsui branches: 1.3.6;
Misc KNF and cosmetics.
 1.2 12-Jan-2013  tsutsui branches: 1.2.2; 1.2.4; 1.2.6;
Make sure to enable DTR and RTS on TX initialization for SIO console.
 1.1 05-Jan-2013  tsutsui First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.2.6.4 03-Dec-2017  jdolecek update from HEAD
 1.2.6.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2.6.2 25-Feb-2013  tls resync with head
 1.2.6.1 12-Jan-2013  tls file sioreg.h was added on branch tls-maxphys on 2013-02-25 00:28:50 +0000
 1.2.4.1 18-May-2014  rmind sync with head
 1.2.2.3 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.2.2 23-Jan-2013  yamt sync with head
 1.2.2.1 12-Jan-2013  yamt file sioreg.h was added on branch yamt-pagecache on 2013-01-23 00:05:54 +0000
 1.3.6.1 06-Apr-2015  skrll Sync with HEAD
 1.1 05-Jan-2013  tsutsui branches: 1.1.2; 1.1.6;
First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.1.6.2 25-Feb-2013  tls resync with head
 1.1.6.1 05-Jan-2013  tls file status.h was added on branch tls-maxphys on 2013-02-25 00:28:50 +0000
 1.1.2.2 23-Jan-2013  yamt sync with head
 1.1.2.1 05-Jan-2013  yamt file status.h was added on branch yamt-pagecache on 2013-01-23 00:05:54 +0000
 1.2 11-Jan-2014  tsutsui Remove unused KernInter stuff.
 1.1 05-Jan-2013  tsutsui branches: 1.1.2; 1.1.4; 1.1.6;
First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.1.6.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.6.2 25-Feb-2013  tls resync with head
 1.1.6.1 05-Jan-2013  tls file stinger.h was added on branch tls-maxphys on 2013-02-25 00:28:50 +0000
 1.1.4.1 18-May-2014  rmind sync with head
 1.1.2.3 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.2.2 23-Jan-2013  yamt sync with head
 1.1.2.1 05-Jan-2013  yamt file stinger.h was added on branch yamt-pagecache on 2013-01-23 00:05:54 +0000
 1.3 22-Apr-2023  tsutsui Remove ancient /*ARGSUSED*/ comments.
 1.2 15-Jun-2021  tsutsui constify
 1.1 05-Jan-2013  tsutsui branches: 1.1.2; 1.1.6; 1.1.58;
First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.1.58.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.1.6.2 25-Feb-2013  tls resync with head
 1.1.6.1 05-Jan-2013  tls file trap.c was added on branch tls-maxphys on 2013-02-25 00:28:50 +0000
 1.1.2.2 23-Jan-2013  yamt sync with head
 1.1.2.1 05-Jan-2013  yamt file trap.c was added on branch yamt-pagecache on 2013-01-23 00:05:54 +0000
 1.7 13-Oct-2023  tsutsui Fix typo. From OpenBSD/luna88k.
 1.6 17-May-2021  mrg include libkern.h to get moved dkcksum() definition.
 1.5 14-Feb-2015  tsutsui branches: 1.5.34; 1.5.36;
Use proper signedness and exact-width interger types.
 1.4 11-Jan-2014  tsutsui branches: 1.4.6;
Misc KNF and cosmetics.
 1.3 03-Jan-2014  tsutsui Pull more cleanups from OpenBSD/luna88k:

- remove unused declarations
- rename struct scsi_fmt_cdb to scsi_generic_cdb
 1.2 14-Jan-2013  tsutsui branches: 1.2.2; 1.2.4; 1.2.6;
Fix drivers to make secondary SPC SCSI on LUNA-II work properly.
Also bump version.

Now we can load a NetBSD kernel from external SCSI disks on LUNA-II.
(and netboot on LUNA-II also works)
 1.1 05-Jan-2013  tsutsui First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.2.6.4 03-Dec-2017  jdolecek update from HEAD
 1.2.6.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2.6.2 25-Feb-2013  tls resync with head
 1.2.6.1 14-Jan-2013  tls file ufs_disksubr.c was added on branch tls-maxphys on 2013-02-25 00:28:50 +0000
 1.2.4.1 18-May-2014  rmind sync with head
 1.2.2.3 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.2.2 23-Jan-2013  yamt sync with head
 1.2.2.1 14-Jan-2013  yamt file ufs_disksubr.c was added on branch yamt-pagecache on 2013-01-23 00:05:54 +0000
 1.4.6.1 06-Apr-2015  skrll Sync with HEAD
 1.5.36.1 31-May-2021  cjep sync with head
 1.5.34.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.1 05-Jan-2013  tsutsui branches: 1.1.2; 1.1.6;
First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.1.6.2 25-Feb-2013  tls resync with head
 1.1.6.1 05-Jan-2013  tls file vectors.h was added on branch tls-maxphys on 2013-02-25 00:28:50 +0000
 1.1.2.2 23-Jan-2013  yamt sync with head
 1.1.2.1 05-Jan-2013  yamt file vectors.h was added on branch yamt-pagecache on 2013-01-23 00:05:54 +0000
 1.13 15-Jun-2021  tsutsui Fix off-by-one of a number of blocks of probed disks.

The SCSI READ_CAPACITY command returns the last logical data block
address, so we have to increment it to get a number of blocks
as src/sys/dev/scsipi/sd.c does.

Bump revision to denote the change.
 1.12 17-Jan-2016  tsutsui branches: 1.12.34;
Enable LIBSA_CREAD_NOCRC. PR/50638

Also bump version to denote user visible change.
Tested on LUNA-II.
 1.11 16-Apr-2014  tsutsui branches: 1.11.4;
Use booted device unit if no unit number is specified on boot command.

Bump version to denote a visible change.
 1.10 11-Jan-2014  tsutsui branches: 1.10.2;
Bump version to denote support to pass boothowto and bootdev to kernel.
 1.9 10-Jan-2014  tsutsui Reorgenize boot device configuration. The idea is taken from OpenBSD/luna88k.

- remove kernel-like autoconfiguration to probe bootable devices
- initialize SCSI and Ethernet controllers statically instead
- reorganize device softc structures per autoconf removal
- probe and print all SCSI disks (but don't assign unit numbers)
- make sdopen() to recheck the device and allocate softc dynamically
- use controller number and SCSI target ID (ctlr * 10 + id) to specify
the boot disk on the "boot" command arg
- bump version to denote changes

Now bootloader works as the following:
---
>> NetBSD/luna68k boot, Revision 1.8 (Wed Jan 8 22:13:12 JST 2014)
>> (based on Stinger ver 0.0 [Phase-31])

Machine model = LUNA-II
Physical Memory = 0x4000000 (64 MB)

sc0 at 0xe1000000: async, parity, ID 7
ID 3: TEAC FC-1 HGF 10 rev , 512 bytes/sect x 2879 sectors
ID 6: IBM DPES-31080 rev S31Q, 512 bytes/sect x 2118143 sectors
sc1 at 0xe1000040: async, parity, ID 7
ID 6: MELCO DSC-G rev 1.00, 512 bytes/sect x 62533295 sectors
le0: Am7990 LANCE Ethernet, mem at 0x71010000
le0: Ethernet address = 00:00:0a:03:42:77

Press return to boot now, any other key for boot menu
booting sd(16,0)netbsd - starting in 0 seconds.
auto-boot sd(16,0)netbsd
1911696+96040 [280480+159179]=0x255a30
:
 1.8 05-Jan-2014  tsutsui Detect boot device on PROM load command and set proper default boot device.

Also remove now unnecessary the old netboot check.

Note all addresses of boot device info set by monitor are checked by
memory dump on several LUNA ROM versions, and these addres might be
different on earlier monitor ROM versions.

Bump version to denote the visible change.
 1.7 03-Jan-2014  tsutsui Pull more fixes from OpenBSD/luna88k:

- accept empty controller and partition numbers, as well as empty filenames,
and use defaults (0, 0 and "netbsd") instead of complaining the boot path
is invalid
- move a macro where actually necessary

Also bump version to denote the user visible change.
 1.6 05-Mar-2013  tsutsui branches: 1.6.6;
Check netboot and set proper default boot device.
Also bump version.
 1.5 21-Jan-2013  tsutsui branches: 1.5.2; 1.5.6;
Add support for "await key" to abort autoboot and get boot menu.
Also add command help. Bump version.
 1.4 16-Jan-2013  tsutsui Add UFS2 support. Also bump version.
 1.3 14-Jan-2013  tsutsui Fix drivers to make secondary SPC SCSI on LUNA-II work properly.
Also bump version.

Now we can load a NetBSD kernel from external SCSI disks on LUNA-II.
(and netboot on LUNA-II also works)
 1.2 13-Jan-2013  tsutsui Add netboot support.
Based on ews4800mips, mvme68k, and x68k standalone drivers.
Also bump version.

Tested on LUNA-I.

XXX: We really need proper documents about libsa APIs.
 1.1 05-Jan-2013  tsutsui First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.5.6.5 03-Dec-2017  jdolecek update from HEAD
 1.5.6.4 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.5.6.3 23-Jun-2013  tls resync from head
 1.5.6.2 25-Feb-2013  tls resync with head
 1.5.6.1 21-Jan-2013  tls file version was added on branch tls-maxphys on 2013-02-25 00:28:50 +0000
 1.5.2.3 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.2.2 23-Jan-2013  yamt sync with head
 1.5.2.1 21-Jan-2013  yamt file version was added on branch yamt-pagecache on 2013-01-23 00:05:54 +0000
 1.6.6.1 18-May-2014  rmind sync with head
 1.10.2.1 10-Aug-2014  tls Rebase.
 1.11.4.1 19-Mar-2016  skrll Sync with HEAD
 1.12.34.1 17-Jun-2021  thorpej Sync w/ HEAD.

RSS XML Feed