History log of /freebsd-10.0-release/sys/boot/i386/libi386/
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
259065 07-Dec-2013 gjb

- Copy stable/10 (r259064) to releng/10.0 as part of the
10.0-RELEASE cycle.
- Update __FreeBSD_version [1]
- Set branch name to -RC1

[1] 10.0-CURRENT __FreeBSD_version value ended at '55', so
start releng/10.0 at '100' so the branch is started with
a value ending in zero.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

256281 10-Oct-2013 gjb

Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


254733 23-Aug-2013 jkim

Set the hint for physical address of RSDP in hexadecimal as before r223262.


245848 23-Jan-2013 jhb

Always update the hw.uart.console hint anytime a change is made to the
comconsole setup. Previously the hint would be set when if you set a
custom port, but it would not be updated if you later set a custom speed.

Also, leave the hw.uart.console hint mutable so it can be overridden or
unset by the user if needed.

Reviewed by: kib (earlier version)
MFC after: 1 week


245424 14-Jan-2013 sbruno

Quiesce some clang warnings while we're here doing stuff.

Submitted by: Hiren Panchasara <hiren.panchasara@gmail.com>
Obtained from: Yahoo! Inc


241809 21-Oct-2012 ae

Add the flags parameter to the disk_open() function and DISK_F_NOCACHE
flag, that disables the caching of partition tables metadata.
Use this flag for floppies in the libi386/biosdisk driver.


241300 06-Oct-2012 avg

i386 comconsole: don't loop forever if hardware doesn't respond

- clear capability flags when hw timeouts
- retire comc_started status variable and directly use c_flags to see
if comconsole is selected for use

Reviewed by: jhb
Tested by: Uffe Jakobsen <uffe@uffe.org>,
Olivier Cochard-Labbe <olivier@cochard.me>
MFC after: 26 days


241053 29-Sep-2012 ae

Almost each time when loader opens a file, this leads to calling
disk_open(). Very often this is called several times for one file.
This leads to reading partition table metadata for each call. To
reduce the number of disk I/O we have a simple block cache, but it
is very dumb and more than half of I/O operations related to reading
metadata, misses this cache.

Introduce new cache layer to resolve this problem. It is independent
and doesn't need initialization like bcache, and will work by default
for all loaders which use the new DISK API. A successful disk_open()
call to each new disk or partition produces new entry in the cache.
Even more, when disk was already open, now opening of any nested
partitions does not require reading top level partition table.
So, if without this cache, partition table metadata was read around
20-50 times during boot, now it reads only once. This affects the booting
from GPT and MBR from the UFS.


240421 12-Sep-2012 mav

Make pxe device in lsdev really include device name, looking like this:
pxe0: 192.168.3.1:/storage/nfsroot/amd64
, instead of confusing and less useful:
192.168.3.1:pxeboot


239243 13-Aug-2012 dim

After r239066, reinitialize v86.ctl and v86.addr for int 13 EDD probing
in sys/boot/i386/libi386/biosdisk.c. Otherwise, when DISK_DEBUG is
enabled, the DEBUG() macros will clobber those fields, and cause the
probing to always fail mysteriously when debugging is enabled.


239211 12-Aug-2012 ae

Add another debug message.


239066 05-Aug-2012 ae

Add offset field to the i386_devdesc structure to be compatible with
disk_devdesc structure. Update biosdisk driver to the new disk API.


236213 29-May-2012 kevlo

Make sure that each va_start has one and only one matching va_end,
especially in error cases.


235329 12-May-2012 avg

zfsboot/zfsloader: support accessing filesystems within a pool

In zfs loader zfs device name format now is "zfs:pool/fs",
fully qualified file path is "zfs:pool/fs:/path/to/file"
loader allows accessing files from various pools and filesystems as well
as changing currdev to a different pool/filesystem.

zfsboot accepts kernel/loader name in a format pool:fs:path/to/file or,
as before, pool:path/to/file; in the latter case a default filesystem
is used (pool root or bootfs). zfsboot passes guids of the selected
pool and dataset to zfsloader to be used as its defaults.

zfs support should be architecture independent and is provided
in a separate library, but architectures wishing to use this zfs support
still have to provide some glue code and their devdesc should be
compatible with zfs_devdesc.
arch_zfs_probe method is used to discover all disk devices that may
be part of ZFS pool(s).

libi386 unconditionally includes zfs support, but some zfs-specific
functions are stubbed out as weak symbols. The strong definitions
are provided in libzfsboot.
This change mean that the size of i386_devspec becomes larger
to match zfs_devspec.

Backward-compatibility shims are provided for recently added sparc64
zfs boot support. Currently that architecture still works the old
way and does not support the new features.

TODO:
- clear up pool root filesystem vs pool bootfs filesystem distinction
- update sparc64 support
- set vfs.root.mountfrom based on currdev (for zfs)

Mid-future TODO:
- loader sub-menu for selecting alternative boot environment

Distant future TODO:
- support accessing snapshots, using a snapshot as readonly root

Reviewed by: marius (sparc64),
Gavin Mu <gavin.mu@gmail.com> (sparc64)
Tested by: Florian Wagner <florian@wagner-flo.net> (x86),
marius (sparc64)
No objections: fs@, hackers@
MFC after: 1 month


235155 09-May-2012 avg

i386 boot: consolidate MAXBDDEV definition

MFC after: 1 month


232309 29-Feb-2012 jkim

Fix a long standing bug. The caller expects a non-zero value for success.
Luckily keyboard probing was turned off by default from the first revision.

Submitted by: Alexander Sack (asack at niksun dot com)
MFC after: 3 days


232263 28-Feb-2012 dim

Define several extra macros in bsd.sys.mk and sys/conf/kern.pre.mk, to
get rid of testing explicitly for clang (using ${CC:T:Mclang}) in
individual Makefiles.

Instead, use the following extra macros, for use with clang:
- NO_WERROR.clang (disables -Werror)
- NO_WCAST_ALIGN.clang (disables -Wcast-align)
- NO_WFORMAT.clang (disables -Wformat and friends)
- CLANG_NO_IAS (disables integrated assembler)
- CLANG_OPT_SMALL (adds flags for extra small size optimizations)

As a side effect, this enables setting CC/CXX/CPP in src.conf instead of
make.conf! For clang, use the following:

CC=clang
CXX=clang++
CPP=clang-cpp

MFC after: 2 weeks


230325 19-Jan-2012 sbruno

Wrap changes from svn r212126 inside LOADER_NFS_SUPPORT such that
using LOADER_TFTP_SUPPORT excludes this code. Fixes compilation of pxeldr
with -DLOADER_TFTP_SUPPORT

Applicable to stable/9 and stable/8 now.

This appears to not be needed on stable/7 as r212126 has not been MFC'd.

Obtained from: Yahoo! Inc.
MFC after: 2 weeks


229435 03-Jan-2012 kib

Add special loader environment variables 'comconsole_port' and
'comconsole_pcidev'. The former allows to set the base address of the
serial console i/o port. The later takes the string of the format
'bus:device:function:[bar]' as a value and uses the serial port attached
as PCI device at the specified location for console.

Both variants pass 'hw.uart.console' variable to the uart driver to
properly hand-over the kernel console.

Change allows to use ISA serial ports other than COM1 for the
loader/kernel console without loader recompilation. Also, you can use
PCI-attached port as the console, e.g. Intel AMT serial pseudo-port on
some motherboards based on Q67 chipset.

Reviewed by: jhb
MFC after: 2 weeks


228782 21-Dec-2011 ed

Make the RTC checking for QEMU even more aggressive.

At work, where we use use KVM+QEMU, we notice that pxeboot is pratically
impossible because of network timeouts. This is due to the fact that the
RTC code makes aggressive jumps.

Two RTC reads does not seem to be sufficient. Change the code to check
for 8 identical RTC values.

Sponsored by: Kumina bv


227389 09-Nov-2011 jhb

Revert some debugging printfs that crept into 223695.


226748 25-Oct-2011 jhb

- Add a new header for the x86 boot code that defines various structures
and constants related to the BIOS Enhanced Disk Drive Specification.
- Use this header instead of magic numbers and various duplicate structure
definitions for doing I/O.
- Use an actual structure for the request to fetch drive parameters in
drvsize() rather than a gross hack of a char array with some magic
size. While here, change drvsize() to only pass the 1.1 version of
the structure and not request device path information. If we want
device path information you have to set the length of the device
path information as an input (along with probably checking the actual
EDD version to see which size one should use as the device path
information is variable-length). This fixes data smashing problems
from passing an EDD 3 structure to BIOSes supporting EDD 4.

Reviewed by: avg
Tested by: Dennis Koegel dk neveragain.de
MFC after: 1 week


226746 25-Oct-2011 jhb

Consolidate duplicate definitions of V86_CY() and V86_ZR() which check for
the carry and zero flags being set, respectively, in <btxv86.h> and use
them throughout the x86 boot code.


223695 30-Jun-2011 dfr

Add a version of the FreeBSD bootloader which can run in userland, packaged
as a shared library. This is intended to be used by BHyVe to load FreeBSD
kernels into new virtual machines.


223262 18-Jun-2011 benl

Fix clang warnings.

Approved by: philip (mentor)


218893 20-Feb-2011 dim

Upgrade our copy of llvm/clang to r126079, from upstream's trunk.

This contains many improvements, primarily better C++ support, an
integrated assembler for x86 and support for -pg.


215245 13-Nov-2010 nyan

Remove unused includes.


215016 08-Nov-2010 jhb

Remove support for autoloading ACPI from the loader. Leave in the code to
detect ACPI and export info such as the location of the RSDP via hints as
that is still useful.


212805 17-Sep-2010 pjd

Before VirtualBox is fixed, mark with #ifdef what has to be done to make
it possible to boot from ZFS RAIDZ for example from within VirtualBox.
The problem with VirtualBox is that its BIOS reports only one disk present.
If we choose to ignore this report, we can find all the disks available.
We can't have this work-around to be turned on by default, because some broken
BIOSes report true when it comes to number of disks, but present the same disk
multiple times.


212126 02-Sep-2010 rmacklem

Modify pxe.c to use the version of nfs_getrootfh() that returns
the file handle's size and was recently committed to
lib/libstand/nfs.c. This allows pxeboot to use NFSv3 and work
correcty for non-FreeBSD as well as FreeBSD NFS servers.
If built with OLD_NFSV2 defined, the old
code that predated this patch will be used.

Tested by: danny at cs.huji.ac.il


211677 23-Aug-2010 imp

MF tbemd: Minor tweaks, prefer MACHINE_CPUARCH generally to MACHINE_ARCH


200631 17-Dec-2009 nyan

Fix debug messages of bd_io().

MFC after: 1 week


200357 10-Dec-2009 jhb

Don't warn about an RSDP with a corrupt checksum. The kernel does a better
job about warning about these things later and this message can be
confusing.

Submitted by: infofarmer
MFC after: 1 week


200219 07-Dec-2009 jhb

Improve the algorithm the loader uses to choose a memory range for its
heap when using a range above 1MB.

Previously the loader would always use the last 3MB in the first memory
range above 1MB for the heap. However, this memory range is also where the
kernel and any modules are loaded. If this memory range is "small", then
using the high 3MB for the heap may not leave enough room for the kernel
and modules.

Now the loader will use any range below 4GB for the heap, and the logic to
choose the "high" heap region has moved into biosmem.c. It sets two
variables that the loader can use for a high heap if it desires. When a
high heap is enabled (BZIP2, FireWire, GPT, or ZFS), then the following
memory ranges are preferred for the heap in order from best to worst:
- The largest memory region in the SMAP with a start address greater than
1MB. The memory region must be at least 3MB in length. This leaves the
region starting at 1MB purely for use by the kernel and modules.
- The last 3MB of the memory region starting at 1MB if it is at least 3MB
in size. This matches the current behavior except that the current loader
would break horribly if the first region was not at least 3MB in size.
- The memory range from the end of the loader up to the 640k window. This
is the range the loader uses when none of the high-heap-requesting options
are enabled.

Tested by: hrs
MFC after: 1 week


200216 07-Dec-2009 jhb

Various small whitespace and style fixes.


199857 27-Nov-2009 sobomax

Whitespace-only: another instance of identation with spaces.


199856 27-Nov-2009 sobomax

Whitespace on: use tabs for identation consistently.


199855 27-Nov-2009 sobomax

Add new loader console type: "spinconsole". This console selects the
video console which doesn't take any input from keyboard and hides
all output replacing it with ``spinning'' character (useful for
embedded products and custom installations).

Sponsored by: Sippy Software, Inc.


199806 25-Nov-2009 trasz

Be nice, don't use the f-word.


197082 10-Sep-2009 emaste

If the pxe client is told to use / as the root path, honour that rather
of trying to mount /pxeroot instead.

PR: i386/106493
Submitted by: Andrey Russev
MFC after: 1 month


195045 26-Jun-2009 rpaulo

On special systems where the MBR and the GPT are in sync (up to the 4th
slicei, Apple EFI hardware), the bootloader will fail to recognize the GPT
if it finds anything else but the EFI partition. Change the check to continue
detecting the GPT by looking at the EFI partition on the MBR but
stopping successfuly after finding it.

PR: kern/134590
Submitted by: Christoph Langguth <christoph at rosenkeller.org>
Reviewed by: jhb
MFC after: 2 weeks
Approved by: re (kib)


193720 08-Jun-2009 jhb

Instead of packing the individual fields in the PnP structures, pack the
entire structures. This trims some warnings.

Verified by: md5(1)
MFC after: 1 week


193719 08-Jun-2009 jhb

Don't attempt to free the GPT partition list for a disk with an empty GPT.

Submitted by: Yuri Pankov yuri.pankov of gmail
MFC after: 3 days


193530 05-Jun-2009 jkim

Import ACPICA 20090521.


193229 01-Jun-2009 jhb

Add a missing parameter when displaying GPT partitions with an unknown
UUID.

Submitted by: Pawel Worach pawel.worach | gmail
MFC after: 1 week


191111 15-Apr-2009 jkim

A simple rewrite of biossmap.c:

- Do not iterate int 15h, function e820h twice. Instead, we use STAILQ to
store each return buffer and copy all at once.
- Export optional extended attributes defined in ACPI 3.0 as separate
metadata. Currently, there are only two bits defined in the specification.
For example, if the descriptor has extended attributes and it is not
enabled, it has to be ignored by OS. We may implement it in the kernel
later if it is necessary and proven correct in reality.
- Check return buffer size strictly as suggested in ACPI 3.0.

Reviewed by: jhb


191061 14-Apr-2009 jhb

Use a disk address instead of an int to hold the starting offset of an
open partition. This fixes access to partitions whose starting offset
is >= 2 TB.

Submitted by: "James R. Van Artsdalen" james jrv.org
MFC after: 3 days


190814 07-Apr-2009 jkim

Rewrite SMBIOS for loader:

- First three fields of system UUID may be little-endian as described in
SMBIOS Specification v2.6. For now, we keep the network byte order for
backward compatibility (and consistency with popular dmidecode tool)
if SMBIOS table revision is less than 2.6. However, little-endian format
can be forced by defining BOOT_LITTLE_ENDIAN_UUID from make.conf(5) if it
is necessary.
- Replace overly ambitious optimizations with more readable code.
- Update comments to SMBIOS Specification v2.6 and clean up style(9) bugs.


190813 07-Apr-2009 jkim

Increase sprintf(3) buffer size, which I forgot from the previous commit.


190599 31-Mar-2009 jkim

Probe size of installed memory modules from loader and display it
as 'real memory' instead of Maxmem if the value is available.
Note amd64 displayed physmem as 'usable memory' since machdep.c r1.640
to unconfuse users. Now it is consistent across amd64 and i386 again.
While I am here, clean up smbios.c a bit and update copyright date.

Reviewed by: jhb


189749 12-Mar-2009 jhb

The recent change to use memory > 1MB for the heap by default broke CD
booting because the CD driver did not use bounce buffers to ensure
request buffers sent to the BIOS were always in the first 1MB. Copy over
the bounce buffer logic from the BIOS disk driver (minus the 64k boundary
code for floppies) to fix this.

Reported by: kensmith


189588 09-Mar-2009 jhb

- Make it possible to disable GPT support by setting LOADER_NO_GPT_SUPPORT
in make.conf or src.conf.
- When GPT is enabled (which it is by default), use memory above 1 MB and
leave the memory from the end of the bss to the end of the 640k window
purely for the stack. The loader has grown and now it is much more
common for the heap and stack to grow into each other when both are
located in the 640k window.

PR: kern/129526
MFC after: 1 week


187101 12-Jan-2009 jkim

Allow VIA Nano processors to boot FreeBSD/amd64.

PR: amd64/130303
MFC after: 1 week


185095 19-Nov-2008 dfr

If we free the GPT partition list in bd_open_gpt() because of an error, don't
try to free it again in bd_closedisk(). While I'm here, fix a DEBUG print.


185029 17-Nov-2008 pjd

Update ZFS from version 6 to 13 and bring some FreeBSD-specific changes.

This bring huge amount of changes, I'll enumerate only user-visible changes:

- Delegated Administration

Allows regular users to perform ZFS operations, like file system
creation, snapshot creation, etc.

- L2ARC

Level 2 cache for ZFS - allows to use additional disks for cache.
Huge performance improvements mostly for random read of mostly
static content.

- slog

Allow to use additional disks for ZFS Intent Log to speed up
operations like fsync(2).

- vfs.zfs.super_owner

Allows regular users to perform privileged operations on files stored
on ZFS file systems owned by him. Very careful with this one.

- chflags(2)

Not all the flags are supported. This still needs work.

- ZFSBoot

Support to boot off of ZFS pool. Not finished, AFAIK.

Submitted by: dfr

- Snapshot properties

- New failure modes

Before if write requested failed, system paniced. Now one
can select from one of three failure modes:
- panic - panic on write error
- wait - wait for disk to reappear
- continue - serve read requests if possible, block write requests

- Refquota, refreservation properties

Just quota and reservation properties, but don't count space consumed
by children file systems, clones and snapshots.

- Sparse volumes

ZVOLs that don't reserve space in the pool.

- External attributes

Compatible with extattr(2).

- NFSv4-ACLs

Not sure about the status, might not be complete yet.

Submitted by: trasz

- Creation-time properties

- Regression tests for zpool(8) command.

Obtained from: OpenSolaris


183667 07-Oct-2008 jhb

Use CPUID to see if the current CPU supports long mode when attemping to
boot an amd64 kernel. If not, then fail the boot request with an error
message. Otherwise, the boot attempt will fail with a BTX fault when
trying to read the EFER MSR.

MFC after: 3 days


181282 04-Aug-2008 cperciva

Dereferencing uninitialized pointers considered harmful. Prior to this
commit, calling i386_parsedev(..., X, ...) where X is "ad", "bge", or
any other disk or network device name without a unit number, would
result in dereferencing whatever happened to be on the stack where the
variable "cp" is stored.

Found by: LLVM/Clang Static Checker


179825 16-Jun-2008 olli

Implement a workaround for a long-standing problem in
libi386's time(), caused by a qemu bug. The bug might
be present in other BIOSes, too.

qemu either does not simulate the AT RTC correctly or
has a broken BIOS 1A/02 implementation, and will return
an incorrect value if the RTC is read while it is being
updated.

The effect is worsened by the fact that qemu's INT 15/86
function ("wait" a.k.a. usleep) is non-implmeneted or
broken and returns immediately, causing beastie.4th to
spin in a tight loop calling the "read RTC" function
millions of times, triggering the problem quickly.

Therefore, we keep reading the BIOS value until we get
the same result twice. This change fixes beastie.4th's
countdown under qemu.

Approved by: des (mentor)


179631 07-Jun-2008 jhb

Workaround a bug in the BIOS of Dell R900 machines. Specifically, each
entry in the SMAP is a 20 byte structure and they are queried from the
BIOS via sucessive BIOS calls. Due to an apparent bug in the R900's
BIOS, for some SMAP requests the BIOS overflows the 20 byte buffer
trashing a few bytes of memory immediately after the SMAP structure. As
a workaround, add 8 bytes of padding after the SMAP structure used in
the loader for SMAP queries.

PR: i386/122668
Submitted by: Mike Hibler mike flux.utah.edu, silby
MFC after: 3 days


176646 28-Feb-2008 jhb

Tweak the verbose disk printing a bit:
- Consolidate the code to humanize the size of a disk partition into a
single function based on the code for GPT partitions and use it for
GPT partitions, BSD slices, and BSD partitions.
- Teach the humanize code to use KB for small partitions (e.g. GPT boot
partitions now show up as 64KB rather than 0MB).
- Pad a few partition type names out so that things line up in the
common case.

MFC after: 1 week


173575 12-Nov-2007 bz

Though we are currently not interested in the EDD3 flag,
Enhanced Disk Drive Specification Ver 3.0 defines that the version
of extension in AH would be 30h.
Correct the check for that to be >=30h instead of >3h.
MFC after: 2 months


173118 28-Oct-2007 jhb

- Add constants for the different memory types in the SMAP table.
- Use the SMAP types and constants from <machine/pc/bios.h> in the boot
code rather than duplicating it.


172974 25-Oct-2007 jhb

Break out of the I/O retry loop as soon as an I/O operation succeeds rather
than always retrying operations three times.

Submitted by: nyan


172940 24-Oct-2007 jhb

First cut at support for booting a GPT labeled disk via the BIOS bootstrap
on i386 and amd64 machines. The overall process is that /boot/pmbr lives
in the PMBR (similar to /boot/mbr for MBR disks) and is responsible for
locating and loading /boot/gptboot. /boot/gptboot is similar to /boot/boot
except that it groks GPT rather than MBR + bsdlabel. Unlike /boot/boot,
/boot/gptboot lives in its own dedicated GPT partition with a new
"FreeBSD boot" type. This partition does not have a fixed size in that
/boot/pmbr will load the entire partition into the lower 640k. However,
it is limited in that it can only be 545k. That's still a lot better than
the current 7.5k limit for boot2 on MBR. gptboot mostly acts just like
boot2 in that it reads /boot.config and loads up /boot/loader. Some more
details:
- Include uuid_equal() and uuid_is_nil() in libstand.
- Add a new 'boot' command to gpt(8) which makes a GPT disk bootable using
/boot/pmbr and /boot/gptboot. Note that the disk must have some free
space for the boot partition.
- This required exposing the backend of the 'add' function as a
gpt_add_part() function to the rest of gpt(8). 'boot' uses this to
create a boot partition if needed.
- Don't cripple cgbase() in the UFS boot code for /boot/gptboot so that
it can handle a filesystem > 1.5 TB.
- /boot/gptboot has a simple loader (gptldr) that doesn't do any I/O
unlike boot1 since /boot/pmbr loads all of gptboot up front. The
C portion of gptboot (gptboot.c) has been repocopied from boot2.c.
The primary changes are to parse the GPT to find a root filesystem
and to use 64-bit disk addresses. Currently gptboot assumes that the
first UFS partition on the disk is the / filesystem, but this algorithm
will likely be improved in the future.
- Teach the biosdisk driver in /boot/loader to understand GPT tables.
GPT partitions are identified as 'disk0pX:' (e.g. disk0p2:) which is
similar to the /dev names the kernel uses (e.g. /dev/ad0p2).
- Add a new "freebsd-boot" alias to g_part() for the new boot UUID.

MFC after: 1 month
Discussed with: marcel (some things might still change, but am committing
what I have so far)


172927 24-Oct-2007 jhb

Rework the read/write support in the bios disk driver some to cut down
on duplicated code and support 64-bit LBAs for GPT.
- The code to manage an EDD or C/H/S I/O request are now in their own
routines. The EDD routine now handles a full 64-bit LBA instead of
truncating LBAs to the lower 32-bits. (MBRs and BSD labels only
have 32-bit LBAs anyway, so the only LBAs ever passed down were 32-bit).
- All of the bounce buffer and retry logic duplicated in bd_read() and
bd_write() are merged into a single bd_io() routine that takes an
extra direction argument. bd_read() and bd_write() are now simple
wrappers around bd_io().
- If a disk supports EDD then always use it rather than only using it if
the cylinder is > 1023. Other parts of the boot code already do
something similar to this. Also, GPT just uses LBAs, so for a GPT disk
it's probably best to ignore C/H/S completely. Always using EDD when
it is supported by a disk is an easy way to accomplish this.

MFC after: 1 week


172922 24-Oct-2007 jhb

Reindent the read/write code of bd_realstrategy() so it is more readable.

MFC after: 1 week


172921 24-Oct-2007 jhb

Slightly cleanup the 'bootdev' concept on x86 by changing the various
macros to treat the 'slice' field as a real part of the bootdev instead
of as hack that spans two other fields (adaptor (sic) and controller)
that are not used in any modern FreeBSD boot code.

MFC after: 1 week


172591 12-Oct-2007 ps

Do not attempt to make an NFS rpc call if using tftp

PR: kern/91720
Submitted by: Ruben Kerkhof


169842 21-May-2007 jkim

Use lower cases for UUID string to conform RFC4122 and ISO/IEC-9834-8:2005.


167814 22-Mar-2007 jkim

Catch up with ACPI-CA 20070320 import.


163914 02-Nov-2006 ru

Revert the last change. Masking only 2 MSBs of the virtual address
to get the physical address doesn't work for all values of KVA_PAGES,
while masking 8 MSBs works for all values of KVA_PAGES that are
multiple of 4 for non-PAE and 8 for PAE. (This leaves us limited
with 12MB for non-PAE kernels and 14MB for PAE kernels.)

To get things right, we'd need to subtract the KERNBASE from the
virtual address (but KERNBASE is not easy to figure out from here),
or have physical addresses set properly in the ELF headers.

Discussed with: jhb


163897 02-Nov-2006 marcel

Extend struct devdesc with a unit field, called d_unit. Promote the
device (kind) specific unit field to the common field. This change
allows a future version of libefi to work without requiring anything
more than what is defined in struct devdesc and as such makes it
possible to compile said version of libefi for different platforms
without requiring that those platforms have identical derivatives
of struct devdesc.


163765 29-Oct-2006 ru

Because the BTX mini-kernel now uses flat memory mode and clients
are no longer limited to a virtual address space of 16 megabytes,
only mask high two bits of a virtual address. This allows to load
larger kernels (up to 1 gigabyte). Not masking addresses at all
was a bad idea on machines with less than >3G of memory -- kernels
are linked at 0xc0xxxxxx, and that would attempt to load a kernel
at above 3G. By masking only two highest bits we stay within the
safe limits while still allowing to boot larger kernels.

(This is a safer reimplmentation of sys/boot/i386/boot2/boot.2.c
rev. 1.71.)

Prodded by: jhb
Tested by: nyan (pc98)


163708 26-Oct-2006 ru

Adopt comments borrowed from aout_freebsd.c.


162814 29-Sep-2006 ru

Fix most of the WARNS=2 warnings.


162813 29-Sep-2006 jhb

Oops, add return values for the smap command function. We must have the
warnings set weird or something because gcc didn't warn about this at all.

Submitted by: ru


162743 28-Sep-2006 jhb

Add an 'smap' command that dumps out the BIOS SMAP.

MFC after: 1 week


159096 31-May-2006 iedowse

Increment the disk block offset after writing, not before. This
fixes filesystem corruption when nextboot.conf is located after
cylinder 1023. The bug appears to have been introduced at the time
bd_read was copied to create bd_write.

PR: bin/98005
Reported by: yar
MFC after: 1 week


158023 25-Apr-2006 jhb

Use PTOV() to convert physical addresses to appropriate virtual addresses
in the loader when searching for the ACPI RSDP. (The loader runs in a flat
mode with va 0 == pa 0xa000.)


157668 11-Apr-2006 jhb

Drop the gateA20() function in the loader as it is unused. All the other
boot loaders that load the loader already handle A20. In fact, they are
required to do so in order to setup the environment that btxldr expects.


156712 14-Mar-2006 jkim

Export SMBIOS serial numbers by default. To turn it off, use
'BOOT_HIDE_SERIAL_NUMBERS' knob.

Suggested by: ceri


156558 10-Mar-2006 jkim

Micro-optimize invalid UUID check.


156519 09-Mar-2006 jkim

- Implement serial numbers, UUID, and asset tag (turned off by default).
Use 'BOOT_SENSITIVE_INFO=YES' variable to turn them on.
- Use 'uint*_t' instead of 'u_int*_t', correct compilation warnings, and
update copyright while I am here.


153589 21-Dec-2005 sobomax

For the cases when loading bzip2-compressed kernels enabled use last
3MB of physical memory for heap instead of range between 1MB and 4MB.
This makes this feature working with PAE and amd64 kernels, which are
loaded at 2MB. Teach i386_copyin() to avoid using range allocated by
heap in such case, so that it won't trash heap in the low memory
conditions.

This should make loading bzip2-compressed kernels/modules/mfs images
generally useable, so that re@ team is welcome to evaluate merits
of using this feature in the installation CDs.

Valuable suggestions by: jhb


153535 19-Dec-2005 sobomax

Long-long time ago, when the trees were large and memory expensive amount of
memory directly available to loader(8) and friends was limited to 640K on i386.
Those times have passed long time ago and now loader(8) can directly access
up to 4GB of RAM at least theoretically. At the same time, there are several
places where it's assumed that malloc() will only allocate memory within
first megabyte.

Remove that assumption by allocating appropriate bounce buffers for BIOS
calls on stack where necessary.

This allows using memory above first megabyte for heap if necessary.


151452 18-Oct-2005 jkim

Export processor socket information. New environment variables are:

smbios.socket.enabled: number of enabled sockets
smbios.socket.populated: number of populated sockets


150470 22-Sep-2005 ru

Cause all flags passed by boot2 to set the respective loader(8)
boot_* variable. The end effect is that all flags from boot2
are now passed to the kernel.


150469 22-Sep-2005 ru

Add loader(8) variables for RB_DFLTROOT, RB_MUTE, and RB_PAUSE:
"boot_dfltroot", "boot_mute", and "boot_pause" respectively.


149213 18-Aug-2005 iedowse

Add a "comconsole_speed" loader variable that can be used to change
the serial console speed (i386 and amd64 only). If the previous
stage boot loader requested a serial console (RB_SERIAL or RB_MULTIPLE)
then the default speed is determined from the current serial port
speed. Otherwise it is set to 9600 or the value of BOOT_COMCONSOLE_SPEED
at compile time.

This makes it possible to set the serial port speed once in
/boot.config and the setting will propagate to boot2, loader and
the kernel serial console.


148450 27-Jul-2005 jkim

Simplify SMBIOS loader variables and drop `hint.smbios.0.enabled'.

They are not real hints.

Reported by: des
Pointed out by: peter
Approved by: anholt (mentor)


148006 14-Jul-2005 jkim

Scan static SMBIOS structures and export the following environment
variables to loader:

hint.smbios.0.enabled "YES" when SMBIOS is detected

hint.smbios.0.bios.vendor BIOS vendor
hint.smbios.0.bios.version BIOS version
hint.smbios.0.bios.reldate BIOS release date

hint.smbios.0.system.maker System manufacturer
hint.smbios.0.system.product System product name
hint.smbios.0.system.version System version number

hint.smbios.0.planar.maker Base board manufacturer
hint.smbios.0.planar.product Base board product name
hint.smbios.0.planar.version Base board version number

hint.smbios.0.chassis.maker Enclosure manufacturer
hint.smbios.0.chassis.version Enclosure version

These strings can be used to detect hardware quirks and to set appropriate
flags. For example, Compaq R3000 series and some HP laptops require

hint.atkbd.0.flags="0x9"

to boot. See amd64/67745 for more detail.

Note: Please do not abuse this feature to resolve general problem when it
can be fixed programmatically. This must be used as a last resort.

PR: kern/81449
Approved by: anholt (mentor)


146698 27-May-2005 jhb

- Add support to the loader for multiple consoles.
- Teach the i386 and pc98 loaders to honor multiple console requests from
their respective boot2 binaries so that the same console(s) are used in
both boot2 and the loader.
- Since the kernel doesn't support multiple consoles, whichever console is
listed first is treated as the "primary" console and is passed to the
kernel in the boot_howto flags.

PR: kern/66425
Submitted by: Gavin Atkinson gavin at ury dot york dot ac dot uk
MFC after: 1 week


146697 27-May-2005 jhb

Fix a warning by adding a missing 'const'.

MFC after: 1 week


146448 20-May-2005 charnier

Remove unused variables. Remove prototype for function that does not exist.


145209 17-Apr-2005 wollman

Pass the hostname we got from DHCP to the kernel so that machines can
share a read-only NFS root.


145158 16-Apr-2005 njl

Extend a local buffer to prevent an overflow of the XSDT address.

Submitted by: Joerg Sonnenberger
Obtained from: DragonflyBSD
MFC after: 1 day


144837 09-Apr-2005 stefanf

Fix 'implicit int' instance.


143476 12-Mar-2005 kan

Allow kernels loaded by pxeboot, which was compiled with LOADER_TFTP_SUPPORT,
to stll be able to mount NFS root as prescribed by DCHP configuration. Since
pxeboot is using TFTP to get to the files, pxeboot can not rely on NFS to
provide it a root directory hande as a side effect. pxeboot has to make RPC
mount call itself.


138249 01-Dec-2004 scottl

Remove the last vestiges of the userconfig option. None of this actually
did anything, so this commit should be considered a NO-OP.


137419 08-Nov-2004 peter

Remove a pre-tier-1 kernel compatability helper. This means a 6.x loader
won't boot a pre-5.1 development amd64 kernel. That's no big loss though.


136910 24-Oct-2004 ru

For variables that are only checked with defined(), don't provide
any fake value.


136779 22-Oct-2004 simokawa

- Add FireWire subclass and OHCI interface.
- Add some PCI BIOS function calls.
(find_devclass, read_config, write_config)


135538 21-Sep-2004 wes

Trap invalid sector size 0 in disk probe, refusing to add such a
device to the list. This prevents crashes on /0 errors in 'lsdev'
et al.

Reviewed-by: jhb@
MT5 after: RE approval


134459 29-Aug-2004 iedowse

Add the loader side of support for preloading ELF relocatable object
format modules, which are currently only used on the amd64 platform.
This initial implementation just parses enough of the module to
allow it to extract dependencies and load all the bits into the
right place in memory, so the kernel must still do the full relocation
and linking. The details of the loaded sections are passed to the
kernel by supplying a copy of the ELF section header table as module
metadata with the MODINFOMD_SHDR tag.


130603 16-Jun-2004 phk

Unspam sys/boot, the dev_t commit should not have touched these.

Spotted by: peter


130585 16-Jun-2004 phk

Do the dreaded s/dev_t/struct cdev */
Bump __FreeBSD_version accordingly.


130579 16-Jun-2004 phk

Premptively fix GCC3.4 issue: add break; after empty default: clauses.

PR: 65493
Submitted by: Pawel Worach <sajd@telia.com>


129702 25-May-2004 njl

Use the correct location of the EBDA for searching for the RSDP.
The EBDA is the 1 KB area addressed by the 16 bit pointer at 0x40E.

Pointed out by: robert.moore AT intel.com


129240 14-May-2004 ru

Back out last revision that unnecessarily changed valid assembler
line comments and damaged the CVS history.

Prompted by: bde, jhb


129195 14-May-2004 jdp

Fix a potential stack buffer overflow on systems whose ACPI OEMID
fills its field (6 characters). In that case the OEMID is not
null-terminated, and the sprintf that was used would copy up to the
next null byte, which could be pretty far away.


128716 28-Apr-2004 ru

After talking to Bruce Evans and reading more standards specs,
switch to using C99-style comments everywhere in preprocessed
assembler. The reason is that lines starting with the regexp
'^[[:space:]]#' are treated as preprocessing directives, and
while it seems to work now with GCC, it's not necessarily has
to work. Use C99 comments `//' for the trailing comments to
save whitespace.


125581 07-Feb-2004 ru

Argh, unbreak "make depend" for AMD64.

Reported by: kris


125566 07-Feb-2004 ru

- Removed -elf which is not a valid gcc(1) option anymore.
- Removed -ffreestanding; it's enforced by ../Makefile.inc.


125556 07-Feb-2004 ru

Untangle building of AMD64 boot code.

Tested on: amd64 (sledge)


125537 06-Feb-2004 ru

First round of cleanups to sys/boot/ makefiles:

- do not use PROG for what's not a real C program,
- use sys.mk transformation rules where possible,
- only create the "machine" symlink on AMD64,
- removed MAINTAINER lines in individual makefiles,
- added the LIBSTAND defitinion to <bsd.libnames.mk>,
- somewhat better contents in .depend files.

Tested on: i386, amd64
Prodded by: bde


124818 21-Jan-2004 jhb

If a transfer to or from a floppy disk crosses a 64k boundary, we have to
use a bounce buffer for the actual transfer to avoid crossing a 64k
boundary. To do this, we malloc a buffer twice as big as we need and then
find an aligned block within that buffer to do the transfer. The check
to see which part of the block we use used the wrong variable for part of
the condition meaning that in certain edge cases we would ask the BIOS to
cross a 64k boundary. The BIOS request would then fail resulting in file
transfers that just magically fail in the middle without any apparent
reason. Specifically, my tests for the splitfs boot floppies managed to
trigger this edge case.

MFC after: 1 week
X-MFC-info: along with fixes to libstand filesystems


120118 16-Sep-2003 bde

Don't repeat selected defines from ns16550.h or sioreg.h. Just
include ns16550.h. The missing installation of ns16550.h was fixed
long ago and the misplaced defines in sioreg.h were fixed recently.


119482 25-Aug-2003 obrien

Use __FBSDID().
Also some minor copyright style cleanups.


118607 07-Aug-2003 jhb

Consistently use the BSD u_int and u_short instead of the SYSV uint and
ushort. In most of these files, there was a mixture of both styles and
this change just makes them self-consistent.

Requested by: bde (kern_ktrace.c)


118604 07-Aug-2003 njl

Null terminate the OEM hint. This rids my laptop of the smiley face that
would follow the 6 valid chars of the table entry.


117529 13-Jul-2003 njl

Add include file so this builds with new acpica

Reported by: Kevin Oberman <oberman@es.net>


117160 02-Jul-2003 ru

Revert non-style part of the recent two deltas that dealt with
using as(1) to compile plain assembler source files; bsd.lib.mk
has been fixed (in revision 1.147).


116451 16-Jun-2003 iedowse

When looking for the ':' separator in the root path, don't go past
the terminating '\0'. Since the initialisation of rootpath in
libstand/bootp.c may copy junk into the rest of the buffer, it was
possible for the code to find a ':' after the '\0' and do the wrong
thing.

Reviewed by: ps
MFC after: 1 week


115964 07-Jun-2003 obrien

Add ${AFLAGS} to 'as' invocation.


115670 02-Jun-2003 obrien

Don't use a C compiler to assemble a pure asm file.


115091 17-May-2003 peter

Fix a bug in the AMD64 trampoline. I misunderstood the implicit
32->64 bit zero extend. This changes a movl to an orq.

Approved by: re (amd64 bits)


114933 12-May-2003 peter

Revert leftover AMD64 disable-acpi-module stuff.


114920 11-May-2003 peter

For amd64 kernels, repeat the 1GB mapping over the entire address space
instead of just at 0GB and 1GB marks. This gives more flexibility for
the choice of KERNBASE.

Approved by: re (amd64 stuff)


114385 01-May-2003 peter

Argh. This was broken by the last-minute elf32/elf64/"elf kernel" changes.


114380 01-May-2003 peter

Nuke; repocopied to elf32_freebsd.c where it lives on.


114379 01-May-2003 peter

Enable the i386 loader to load and run an amd64 kernel. If this puts
things over floppy size limits, I can exclude it for release builds or
something like that. Most of the changes are to get the load_elf.c file
into a seperate elf32_ or elf64_ namespace so that you can have two
ELF loaders present at once. Note that for 64 bit kernels, it actually
starts up the kernel already in 64 bit mode with paging enabled. This
is really easy because we have a known minimum feature set.

Of note is that for amd64, we have to pass in the bios int 15 0xe821
memory map because once in long mode, you absolutely cannot make VM86
calls. amd64 does not use 'struct bootinfo' at all. It is a pure loader
metadata startup, just like sparc64 and powerpc. Much of the
infrastructure to support this was adapted from sparc64.


114339 30-Apr-2003 peter

ACPI will always be present on AMD64 - it will never be an autodetect
module.


114246 29-Apr-2003 njl

Support functions for the new ACPI import.
* AcpiOsDerivePciId(): finds a bus number, given the slot/func and the
acpi parse tree.
* AcpiOsPredefinedOverride(): use the sysctl hw.acpi.os_name to
override the value for _OS.

Ideas from: takawata, jhb
Reviewed by: takawata, marcel
Tested on: i386, ia64


113083 04-Apr-2003 phk

Libdisk does not need to include <sys/diskslice.h> any more.

Move the remaining bits of <sys/diskslice.h> to <i386/include/bootinfo.h>

Move i386/pc98 specific bits from <sys/reboot.h> to
<i386/include/bootinfo.h> as well.

Adjust includes in sys/boot accordingly.


109559 20-Jan-2003 phk

Use NEXTDOSPART instead of MAX_SLICES.


106385 03-Nov-2002 phk

Correctly recognize both bogus and genuine BSD disklabels.

Don't expect me to participate in a discussion which is which.

Sponsored by: DARPA & NAI Labs.


104272 01-Oct-2002 phk

Split MBR and PC98 on-disk sliceformats out from disklabel.h, step 1:

Peter had repocopied sys/disklabel.h to sys/diskpc98.h and sys/diskmbr.h.

These two new copies are still intact copies of disklabel.h and
therefore protected by #ifndef _SYS_DISKLABEL_H_ so #including them
in programs which already include <sys.disklabel.h> is currently a
no-op.

This commit adds a number of such #includes.

Once I have verified that I have fixed all the places which need fixing,
I will commit the updated versions of the three #include files.

Sponsored by: DARPA & NAI Labs.


103870 23-Sep-2002 alfred

use __packed.


102960 05-Sep-2002 iwasaki

Parse hint.acpi.0.disabled correctly.
Now that hint.acpi.0.disabled="0" won't disable acpi as expected.

Pointed-out by: bde


102612 30-Aug-2002 iwasaki

s/hint.acpi.0.disable/hint.acpi.0.disabled/

Fix device hints entry for disabling acpi(4).
This also should fix the arbitration with apm(4) when both drivers
are enabled.

Note that your /boot/device.hints needs to be updated if you want to
stop auto-loading acpi.ko or disable acpi(4).


102588 29-Aug-2002 peter

Actually remove the stale a.out kld support. This is the stuff that was
never updated for the metadata infrastructure.


102556 29-Aug-2002 peter

Initiate deorbit burn of i386 a.out kld "support" in loader. Note that
this was quite broken, it never was updated for metadata support.
The a.out kld file support was never really used, as it wasn't necessary.
You could always load elf kld's, even in an a.out kernel.


101558 09-Aug-2002 obrien

Restore autoloading of ACPI module.

Document the approved ways of disabling it.
Submitted by: Daniel O'Connor <doconnor@gsoft.com.au>


101556 09-Aug-2002 obrien

Don't auto load ACPI -- it causes trouble with my laptop and is TOTALLY
undocumented how to control its loading and queries to freebsd-current
go unanswered.


99682 09-Jul-2002 iwasaki

Resolve conflicts arising from the ACPI CA 20020611 import.


99170 30-Jun-2002 iwasaki

Fix a build problem for the ACPI CA 20020404 import.
Add definition of COMPILER_DEPENDENT_INT64 and also
fix definition of COMPILER_DEPENDENT_UINT64.

Pointed-out by: Michael Nottebrock <michaelnottebrock@gmx.net>


98556 21-Jun-2002 phk

Revert the part of Kirks UFS2 commit which added divdi3.c and moddi3.c
to libi386, this issue was resolved already in a cleaner way.


98542 21-Jun-2002 mckusick

This commit adds basic support for the UFS2 filesystem. The UFS2
filesystem expands the inode to 256 bytes to make space for 64-bit
block pointers. It also adds a file-creation time field, an ability
to use jumbo blocks per inode to allow extent like pointer density,
and space for extended attributes (up to twice the filesystem block
size worth of attributes, e.g., on a 16K filesystem, there is space
for 32K of attributes). UFS2 fully supports and runs existing UFS1
filesystems. New filesystems built using newfs can be built in either
UFS1 or UFS2 format using the -O option. In this commit UFS1 is
the default format, so if you want to build UFS2 format filesystems,
you must specify -O 2. This default will be changed to UFS2 when
UFS2 proves itself to be stable. In this commit the boot code for
reading UFS2 filesystems is not compiled (see /sys/boot/common/ufsread.c)
as there is insufficient space in the boot block. Once the size of the
boot block is increased, this code can be defined.

Things to note: the definition of SBSIZE has changed to SBLOCKSIZE.
The header file <ufs/ufs/dinode.h> must be included before
<ufs/ffs/fs.h> so as to get the definitions of ufs2_daddr_t and
ufs_lbn_t.

Still TODO:
Verify that the first level bootstraps work for all the architectures.
Convert the utility ffsinfo to understand UFS2 and test growfs.
Add support for the extended attribute storage. Update soft updates
to ensure integrity of extended attribute storage. Switch the
current extended attribute interfaces to use the extended attribute
storage. Add the extent like functionality (framework is there,
but is currently never used).

Sponsored by: DARPA & NAI Labs.
Reviewed by: Poul-Henning Kamp <phk@freebsd.org>


98472 20-Jun-2002 peter

Add boot_serial and boot_multicons variables to set RB_SERIAL and
RB_MULTIPLE since this seems to be the easiest way to add these flags
for non-forth loaders etc.


96843 18-May-2002 phk

Fix one of the va_arg() with less than int sized type probelms.


96654 15-May-2002 jhay

DEV_BSIZE lives in sys/param.h and not in machine/param.h anymore.


96513 13-May-2002 ru

Removed now unused INTERNALSTATICLIB.
INTERNALLIB now implies NOPIC and NOPROFILE.
Removed gratuitous NOMAN.


96455 12-May-2002 obrien

Back out last commit. I expect our bsd.*.mk gods to remove the need for
defining so many extra things in addition to INTERNALLIB. We don't like
repetitive C code and we shouldn't for make code either.


96415 11-May-2002 obrien

NOPIC, NOPROFILE, NOMAN, and INTERNALSTATICLIB are redundant when using
INTERNALLIB now.


96306 10-May-2002 obrien

-ffreestanding is the word for /sys.


88874 04-Jan-2002 jhb

Don't turn on RB_CDROM if the rootdev is a BIOS cd device for now as this
breaks when cdboot is used with an MFS root.


87633 11-Dec-2001 jhb

Add support for writing to BIOS disks.

PR: kern/32389
Submitted by: Jonathan Mini <mini@haikugeek.com>
Sponsored by: ClickArray, Inc.


87620 10-Dec-2001 guido

Add new boot flag to i386 boot: -p.
This flag adds a pausing utility. When ran with -p, during the kernel
probing phase, the kernel will pause after each line of output.
This pausing can be ended with the '.' key, and is automatically
suspended when entering ddb.

This flag comes in handy at systems without a serial port that either hang
during booting or reser.
Reviewed by: (partly by jlemon)
MFC after: 1 week


87599 10-Dec-2001 obrien

Update to C99, s/__FUNCTION__/__func__/,
also don't use ANSI string concatenation.


86091 05-Nov-2001 jhb

Add a device driver for the BIOS device for CD-ROM's booted via El Torito
no emulation mode. Unlike other BIOS devices, this device uses 2048 byte
sectors. Also, the bioscd driver does not have to worry about slices
or partitions.


85376 23-Oct-2001 jlemon

Set RB_MULTIPLE (multiple console support) if the kernel is booted
with the -D flag.


84461 04-Oct-2001 jhb

Whitespace fixes.


84371 02-Oct-2001 yokota

Fix the ANSI color escape sequence \E[m.

- Corretly map the ansi color number to a PC BIOS color.
- Handle multiple arguments to the escape sequence.


84354 02-Oct-2001 yokota

Fix the local macro: isvisible().

- The space char (0x20) IS a visible char :-)


84277 01-Oct-2001 yokota

Fix the function CD(): "Clear to the end of the screen".

- When the video BIOS is called to clear the region (x, y)-(79, 24)
(by scrolling), the slashed region in Fig.1 is cleared. CD() is
supposed to clear the region shown in Fig.2.
x x
+-------+ +-------+
| | | |
y| ////| y| ////|
| ////| |///////|
| ////| |///////|
+-------+ +-------+
Fig.1 Fig.2

- Don't move the cursor during this operation.


84276 01-Oct-2001 yokota

This is white-space only change. No functional difference.

- Be consistent about placing spaces around keywords and
operators; don't mix statements like "if(A==B)" and "if (X == Y)",
"return(0)" and "return (-1)", "P=10" and "Q = 0", etc.

- Consitently indent lines. It's not good to indent by 8 columns
in one part of the file, and by 4 columns in the other part.


83321 11-Sep-2001 peter

Implement the long-awaited module->file cache database. A userland
tool (kldxref(8)) keeps a cache of what modules and versions are inside
what .ko files. I have tested this on both Alpha and i386.

Submitted by: bp


82531 30-Aug-2001 msmith

Teach the loader how to find the system ACPI information, and autoload
the ACPI module if the system apperars to be ACPI compliant.

This is an initial cut; the load should really be done by Forth support
code, and we should check both the BIOS build date and a blacklist.


80203 23-Jul-2001 kris

s/adress/address/

Inspired by: OpenBSD
MFC After: 1 week


74265 14-Mar-2001 ps

Don't set the gateway address if the netmask is zero or we're on
the same network. PXE does not do netmask calculations, so if the
gateway is set it will use it.

Submitted by: peter & FreeBSD cluster ACLs


72640 18-Feb-2001 asmodai

Preceed/preceeding are not english words. Use precede or preceding.


68362 05-Nov-2000 ps

Honor the ip address given in the root-path dhcp option.

PR: 21743
Submitted by: Brian Candler <B.Candler@pobox.com>


68264 02-Nov-2000 jhb

The Number of Fixed Disks at memory location 0x475 is only 1 byte, not a
2 byte word. This fixes machines that probe 30-odd hard drives during boot
in the loader.

Submitted by: Helpful folks at Tyan via ps


66133 20-Sep-2000 archie

Add support for the "nullconsole" console type, for systems with
neither a video console nor a serial port. Use it if the RB_MUTE
flag is set.

Submitted by: Doug Ambrisko <ambrisko@whistle.com>
Reviewed by: jhb


65498 05-Sep-2000 msmith

Export the salient configuration items in a non-pxe-specific namespace
to allow commonality between varying platforms. This is a step
towards parsing the diskless configuration information with MI code
inside the kernel.

Export the interface hardware address to the kernel, so that it is possible
to determine the boot interface with certainty.

Export the NFS filehandle for the root mount to the kernel, so that the
kernel does not need to perform a mount RPC call.


64527 11-Aug-2000 ps

Add support to send the string 'PXEClient' as the Vendor class
identifier to the DHCP server. Now you can check for this string
in your dhcp configuration to decide whether you will hand out a
lease to the client or not.


64522 11-Aug-2000 ps

Pass along the interesting variables we were given from DHCP so we
can utilize them in the kernel and with kenv.


64187 03-Aug-2000 jhb

Cleanup warnings. Most of these are signed/unsigned warnings, as well as
some added const's.


64186 03-Aug-2000 jhb

Fix several BDECFLAGS warnings. Also, actually use the 'verbose' parameter
for lsdev when printing out slice information. Now, you only get the
sizes and LBA's of slices if you use 'lsdev -v'.


61823 19-Jun-2000 jhb

- Add some more details to the 'lsdev' output for FAT file systems.
- Add in support for the EDD (Enhanced Disk Drive) BIOS extensions to
use LBA mode for accessing drives past cylinder 1024. This should allow
us to load a kernel from anywhere on a newer drive up to 2 TB. Part
of this came from the PR below.

PR: i386/13847
Submitted by: Tor Egge <Tor.Egge@fast.no>


61659 14-Jun-2000 ps

Delay calling the device cleanup routines until the absolute last
moment. We were cleaning up after PXE too early and the module
dependancy code would not be able to load any files if it needed
too.


59855 01-May-2000 ps

Wrap the failure warnings around PXE_DEBUG in the cleanup routine.
It does not matter if they fail, so dont print anything about it
unless we are debugging.


59854 01-May-2000 bp

Update loader logic to distinguish modules vs. files.
Add support for module metadata. The old way of dependancy
handling will be supported for a while.

Reviewed by: peter


59768 29-Apr-2000 ps

Fall back to /pxeroot as the location of the NFS exported directory
if we are not given one by dhcp.
Remove extra includes while I am here.

Reminded by: jlemon


59767 29-Apr-2000 jlemon

Teach the loader about the ext2fs filesystem, extended partitions, and
the new readdir function.


59686 27-Apr-2000 ps

Make PXE do a dhcp request to find out where its files are. The
DHCP server is no longer required to also act as the NFS/TFTP
server.


59673 27-Apr-2000 ps

Don't report errors when we UDP_WRITE fails with a status of 1.


59644 26-Apr-2000 ps

Bring support in for Intel Wired for Management 1.1 (PXE 0.99 and
below). This did not work previously because interrupts were
disabled when PXE calls were being made, and they must be enabled.
This should also allow us to be compliant with all newer PXE rom's
from Intel.

For PXE 0.99, this has been tested using the Intel N440BX motherboard
and I am confident it will work on the Intel L440GX motherboard.

Lots of help/information from: jhb, peter

I would like to thank Michael Johnston <michael.johnston@intel.com>,
Mike Henry <mike.henry@intel.com>, and all the other PXE developers
at Intel for their help, and information in helping solve this
problem.


59473 21-Apr-2000 ps

Move the building of the PXE module into libi386.


59456 21-Apr-2000 ps

Make the loader a little smarter about when it is and is not allowed
to call PXE.


59455 21-Apr-2000 ps

Don't call the PXE cleanup routine if PXE is not enabled. This
should fix the "Invalid partition table" error people were seeing.


59408 20-Apr-2000 ps

Add a cleanup function. This is needed for PXE where you should
shutdown the UNDI and unload the stack.


59390 19-Apr-2000 ps

Use !PXE api over PXENV+ api.
Magic trampoline by: peter (at 4am and after a good whipping at airhockey)
Do a better job of returning and detecting errors.


59100 08-Apr-2000 jkh

Nuke duplicate struct declaration from somebody's paste-o


59087 08-Apr-2000 ps

Make PXE use the UDP API. This allows for both TFTP and NFS support.
You may specify TFTP or NFS via compile time options in the loader,
but not both at this time.

Also, remove a warning about not knowing how to boot from network
devices. We can obviously do that now.


58999 04-Apr-2000 ps

Add a missing PXE API call and structure.


58993 04-Apr-2000 ps

Add all the PXE related structures from the 2.1 PXE spec from Intel.
Fix exsisting code to match the spec.


58713 28-Mar-2000 jhb

Mega i386 loader commit.
- Don't hard code 0x10000 as the entry point for the loader. Instead add
src/sys/boot/i386/Makefile.inc which defines a make variable with the
entry point for the loader. Move the loader's entry point up to
0x20000, which makes PXE happy.
- Don't try to use cpp to parse btxldr for the optional BTXLDR_VERBOSE,
instead use m4 to achieve this. Also, add a BTXLDR_VERBOSE knob in the
btxldr Makefile to turn this option on.
- Redo parts of cdldr's Makefile so that it now builds and installs cdboot
instead of having i386/loader/Makefile do that. Also, add in some more
variables to make the pxeldr Makefile almost identical and thus to ease
maintainability.
- Teach cdldr about the a.out format. Cdldr now parsers the a.out header
of the loader binary and relocates it based on that. The entry point of
the loader no longer has to be hardcoded into cdldr. Also, the boot
info table from mkisofs is no longer required to get a useful cdboot.
- Update the lsdev function for BIOS disks to parse other file systems
(such as DOS FAT) that we currently support. This is still buggy as
it assumes that a floppy with a DOS boot sector actually has a MBR and
parses it as such. I'll be fixing this in the future.
- The biggie: Add in support for booting off of PXE-enabled network
adapters. Currently, we use the TFTP API provided by the PXE BIOS.
Eventually we will switch to using the low-level NIC driver thus
allowing both TFTP and NFS to be used, but for now it's just TFTP.

Submitted by: ps, alfred
Testing by: Benno Rice <benno@netizen.com.au>


58098 15-Mar-2000 jhb

Remove some extra spammage that made it into this commit. This will be
revisited later with a better fix, or at least one that compiles. :)

Approved by: dcs


58081 15-Mar-2000 dcs

Pass an unit number to bcache_strategy, so it can flush the cache when
necessary. Pass an absolute block number too, instead of receiving a
relative one in realstrategy(), as bcache_strategy() requires this.

The fix is sligthly different from the one in the PR.

PR: 17098
Submitted by: John Hood <jhood@sitaranetworks.com>


55211 29-Dec-1999 msmith

Substantially revamp the way that we determine the amount of memory available
for our use. Use the same search order for BIOS memory size functions
as the kernel will later use.

Allow the loader to use all of the detected physical memory (this will
greatly help people trying to load enormous memory disk images).

More correctly handle running out of memory when loading an object.

Use the end of base memory for the top of the heap, rather than
blindly hoping that there is 384k left.

Add copyrights to a couple of files I forgot.


54294 08-Dec-1999 phk

Remove BAD144 support, it has already been disabled for some time.


52395 19-Oct-1999 dcs

Make the "machine" target a prequisite to all source files.

Hinted-at by: bde


50477 28-Aug-1999 peter

$Id$ -> $FreeBSD$


48952 21-Jul-1999 msmith

Walk around the end of all the silly guessing of device types and unit
numbers that we have been doing in the past, and read /etc/fstab off the
proposed root filesystem to determine the actual device name and vfs
type for the root filesystem. These are then exported to the kernel
via the environment variable vfs.root.mountfrom.


48083 21-Jun-1999 rnordier

Fill in bi_bios_geom[] in the bootinfo structure passed to the kernel.
This should resolve the problem raised in PR 12315, and incidentally
makes it easier to determine what geometry the BIOS is actually using
(by way of boot -v and dmesg).


47727 04-Jun-1999 ghelmer

Modify the boot loader to recognize the -C flag and pass the RB_CDROM
flag to the kernel to mount a CDROM as the root filesystem. Alternatively,
the boot_cdrom env var can be set.

As Mike Smith noted, "-C is the "wrong" way to do this", but this is
an acceptable stopgap in lieu of a better way.

PR: bin/11884
Reviewed by: msmith@freebsd.org


44861 18-Mar-1999 dcs

Avoid copying m_args if none exists. (Perhaps this is a better solution,
Doug?)


44572 08-Mar-1999 dcs

Add MODINFO_ARGS, parameters passed to a module at load time.

VS: ----------------------------------------------------------------------


43205 25-Jan-1999 rnordier

Fix a couple of further bugs: missing argument to sprintf() and
"==" used for "=".


43137 24-Jan-1999 msmith

Bleh. Missing 'unit =' doesn't help legacy num_ide_disks code.

PR: bin/9651
Submitted by: "Daniel C. Sobral" <dcs@newsguy.com>


43114 24-Jan-1999 msmith

biosdisk.c
Implement a new variable 'root_disk_unit' which supersedes
'num_ide_disks' and makes it possible to explicitly set the
root device unit number regardless of type considerations.

bootinfo.c
If we can't calculate a dev_t for the root disk, complain and
don't proceed to boot with an invalid boot device.


43068 22-Jan-1999 rnordier

Fix read error not being detected.


42488 10-Jan-1999 steve

Remove redundant line of code.

PR: 9364
Submitted by: Daniel C. Sobral <dcs@newsguy.com>


42480 10-Jan-1999 rnordier

Use etc/make.conf settings for serial port and speed.

Submitted by: rvb
Reviewed by: bde


42419 09-Jan-1999 msmith

Extend bd_print() so that it displays slices and partitions on disks.


42291 04-Jan-1999 peter

Fix a potential sign extension bug on 8-bit chars.
Outputting a backspace isn't supposed to be destructive.. It isn't on
most terminals, nor on the standard bios output (vs. TERM_EMU mode)


42207 31-Dec-1998 abial

Add back ability to make beeps when using new TERM_EMU.

Submitted by: W Gerald Hicks <wghicks@bellsouth.net>


42002 22-Dec-1998 abial

Add simple terminal emulator, compatible with cons25. Currently supported
capabilities are: AF, AB, cm, ho, me, cd. The code is hidden behind
-DTERM_EMU - should it cause any problems, you can remove this define
to get back the old behaviour.

You'll find some examples how to use it in src/share/examples/bootforth.

Reviewed by: jkh


41285 22-Nov-1998 rnordier

Drop use of BIOS int 0x14 services in favor of direct port I/O.

Feedback and testing: Adrian Filipi-Martin <adrian@ubergeeks.com>


41139 13-Nov-1998 msmith

Add a new variable $num_ide_disks which is used to offset the unit number
for SCSI disks when converting from BIOS unit numbers to da unit numbers.

Prompted by Kevin Street <street@iname.com>


40834 02-Nov-1998 msmith

Implement a simple LRU block cache. By default this is initialised to 16k,
and will bypass transfers for more than 8k. Blocks are invalidated after
2 seconds, so removable media should not confuse the cache.

The 8k threshold is a compromise; all UFS transfers performed by
libstand are 8k or less, so large file reads thrash the cache.
However many filesystem metadata operations are also performed using
8k blocks, so using a lower threshold gives poor performance.

Those of you with an eye for cache algorithms are welcome to tell me
how badly this one sucks; you can start with the 'bcachestats' command
which will print the contents of the cache and access statistics.


40775 31-Oct-1998 msmith

- Add a new command 'lsdev' to list devices which might be likely to host
filesystems.
- New 'help' command and data in the help.* files (not yet installed),
provides topic and subtopic help, indexes, etc.
- Don't crash if the user tries to set an invalid console. Be helpful
instead.
- Expand tabs (badly) on the i386 video console.
- Some minor cosmetic changes.


40753 30-Oct-1998 luoqi

Fix an uninitialized variable in the `dangerously dedicated disk' case.


40705 28-Oct-1998 msmith

Simplify the "is a character ready" test, so that we don't return a false
negative for keypresses with zero ascii values. This is in line with the
comconsole test, rather than being more ambitious.

Submitted by: rnordier


40619 23-Oct-1998 msmith

Remove a debugging copy of offsetof() that snuck in.


40617 23-Oct-1998 msmith

PnP enumerator using the PCI BIOS. This is needlessly complex due to the
lack of a simple "enumerate all PCI devices" function.


40601 22-Oct-1998 msmith

PnP BIOS enumerator; mostly useful for hunting PnP devices that are supported
by the system BIOS rather than supporting ISA PnP.


40599 22-Oct-1998 msmith

Add biospnp.c


40554 21-Oct-1998 msmith

Don't depend on being part of the kernel tree. If we are, use the kernel's
<machine> includes rather than the system's.


40393 15-Oct-1998 peter

Get the last used address via a more conservative method, don't depend
on the module chain being in increasing address order.


40338 14-Oct-1998 peter

Try and get the sys/* and machine/* includes via relative paths. This
saves having to do a 'make includes' after touching any header file for
the boot code.


40336 14-Oct-1998 peter

Align to sizeof(long) rather than sizeof(int32_t). It needs to be
long because this code is shared with the alpha. I hope the alpha can
read 32 bit ints at 32 bit alignment (vs. 64 bit alignment).


40216 11-Oct-1998 peter

Fix a warning that's been bugging me for ages.


40212 11-Oct-1998 peter

Only call vidc_init() once (unless forced).
Cosmetic change to the init-time character eater (like, make it increment
the index counter - if there's a problem, it would sit there in an infinite
loop instead of only running 10 times).


40211 11-Oct-1998 peter

Fix comconsole mode. The int 0x14 read and status commands were reversed.
Also, make sure we set %dx each time around otherwise the commands
suddenly start trying to work on things like com92 instead of com1.
Make sure comc_init() is only run once.
Cosmetic change to init-time character eater.


40210 11-Oct-1998 peter

Warn that one of the DEBUG statements has a v86 recursion bug.


40209 11-Oct-1998 peter

Fix comment to match code


40146 09-Oct-1998 peter

Attempt to at least align MODINFO_* blocks. IMHO, decoding this stuff
should be MD code since one day we'll have to recover pages from deleted
preload data. MI code can't be expected to know how to deal with pmap
internals, assuming it gets done via pmap that is. :-)


40145 09-Oct-1998 peter

Turn symbol table info passing back on, although it's probably not
particularly useful in this form. KLD can deal with it much better.
setenv kernelname moved earlier.


40144 09-Oct-1998 peter

Remove kernelname setenv, the common code does it.
Use the metadata for symtab pointers, mainly to keep it common with
elf_freebsd.c.


40107 09-Oct-1998 msmith

Remove some debugging code.
Do a much better job of DWIM with partial device specifications.
Fix the module metadata build process, which was completely broken.
Use a larger read buffer when copying large objects in; this
improves performance marginally and will avoid flushning any small caches
we might choose to implement.


40034 07-Oct-1998 peter

Fix that pesky boot aguments parsing bug. (I think :-)


40032 07-Oct-1998 msmith

Request the flags back when checking for keyboard status.
Submitted by: rnordier


40016 07-Oct-1998 msmith

- Drain the keyboard buffer when initialising.
- Be pedantic about the return from int 16 fn 01.


39989 06-Oct-1998 msmith

bootinfo.c
Strip any device name information from the kernel name
before passing it in.

biosdisk.c
Be more strict about matching device names to slice entries.
Only allow unsliced syntax on unsliced disks.


39960 04-Oct-1998 msmith

Don't include ELF symbol information yet - it causes the ELF DDB to
explode.


39943 04-Oct-1998 msmith

biosdisk.c
Allocate space for, and copy, NDOSPART slice entries from the
MBR, not just one. Add some extra debugging while we're at it.

elf_freebsd.c
Initialise the symbol table start/end pointers in case we don't
have them.


39919 03-Oct-1998 rnordier

bootinfo bi_vesa no longer exists.


39902 02-Oct-1998 msmith

Consolidate the bootinfo-loading code, greatly simplifying the _exec
functions.


39896 02-Oct-1998 msmith

aout_freebsd.c
Use bd_getdev() to work out a dev_t for the root device.
Allow $rootdev to override $currdev as the root device.

biosdisk.c
Save the slice table and disklabel when opening a disk.
Add bd_getdev(), which attempts to return a dev_t corresponding
to a given device. Cases which it still doesn't get right:
- The inevitable da-when-wd-also-exists
- Disks with no slice table (the slice number is not set correctly)
The first is difficult to get right, the second will be
fixed in an upcoming commit.

comconsole.c
vidconsole.c
getchar() should return an 8-bit value; some BIOSsen pack extra
information in %eax.

libi386.h
Remove some stale prototypes, add new ones.


39887 02-Oct-1998 peter

First shot at loading elf symbols. Things are a bit strange because
of the ..umm.. "wierd" way binutils lays out the file. The section
headers are nearly at the end of the file and this is a problem when
loading from a .gz file which can't seek backwards (or has a limited
reverse seek, ~2K from memory).

This is intended to be compatable with the ddb/db_elf.c code and the
alpha/libalpha/elf_freebsd.c layout. I've studied these (which are NetBSD
derived) but did it a bit differently. Naturally the process is similar
since it's supposed to end up with the same result.


39850 30-Sep-1998 peter

Stop libi386.a from being installed..


39833 30-Sep-1998 peter

i386 ELF loader startup backend. On an ELF kernel booted with the 3-stage
bootblocks, the kernel shows up as the primary module:

[3:24am]~-100# kldstat
Id Refs Address Size Name
1 1 0xf0100000 ff00000 /kernel
^^^^ oops.. :-)

Based heavily on aout_freebsd.c. Hmm.. There's so much in common that
these could probably be combined and just check the metadata to see which
format it is.


39832 30-Sep-1998 peter

Save booted kernel name. Cosmetic cleanups.


39831 30-Sep-1998 peter

Fix typos.. The vector for "int 0x12" (get base mem) is not written in
hex as "0x1a". :-)
Fix a comment about the extended memory checks, that's int 0x15.


39756 29-Sep-1998 peter

The bootinfo struct was getting clobbered or not passed through correctly.
Presumably VTOP doesn't work for static objects.
The easiest way to get it working was to reserve some space after the
environment strings and copy the bootinfo struct there.
Also, set RB_BOOTINFO, it's needed.

I got the code to load and run an unmolested kernel OK for the first time
with this system a few minutes ago - at last!. I did have to stop it
looking at the floppy though as BTX was trapping a mode 14 fault when
it look for /boot/boot.conf when no disk was in the drive. (I'm booting
from a scsi disk (bios disk 0x80)).

Now to teach it about ELF and modules :-)


39733 28-Sep-1998 peter

Only bcopy the correct amount of data from the buffer in case it is ever
in an overrun situation.


39731 28-Sep-1998 peter

Reactivate the a.out kernel loader code.


39730 28-Sep-1998 peter

Missing return value that was kinda important.


39729 28-Sep-1998 peter

Argh, I don't believe how much time I wasted looking for this...
Bytes of extended memory = (extkb * 1024), not (extkb + 1024)


39724 28-Sep-1998 peter

MBR magic is 0x55aa not 0xffaa.


39723 28-Sep-1998 peter

Precedence bug (?) causing probe problems.


39673 26-Sep-1998 dfr

* Add old UFS compatibility code to alpha/boot1.
* Fix a raft of warnings, printf and otherwise.
* Allocate the correct amount in mod_searchmodule to prevent an overflow.
* Fix the makefiles so they work outside my home directory (oops).


39662 26-Sep-1998 msmith

The BIOS can't perform a floppy operation where the destination crosses
a physical 64k boundary. Allocate a bounce buffer for such a transaction.


39473 19-Sep-1998 msmith

- Improve debugging code.
- Make the "what do we do with a drunken disklabel" if-then-else-regardless
tangle easier to read.
- Don't count on the v86 structure being preserved between loop iterations,
as it may be trampled eg. by the DEBUG call.


39449 18-Sep-1998 msmith

Synch with development version. Compiles and opens but doesn't work yet.


39447 18-Sep-1998 msmith

We lost all the files in crt/, so define the BIOS sector size here instead.


39441 17-Sep-1998 msmith

Initial integration of the i386 bootloader and BTX.

- Discard large amounts of BIOS-related code in favour of the more compact
BTX vm86 interface.
- Build the loader module as ELF, although the resulting object is a.out,
make gensetdefs 32/64-bit sensitive and use a single copy of it.
- Throw away installboot, as it's no longer required.
- Use direct bcopy operations in the i386_copy module, as BTX
maps the first 16M of memory. Check operations against the
detected size of actual memory.


39178 14-Sep-1998 msmith

Resynch with working sources before BTX integration.

- Use format-independant module allocator.
- Conditionalise ISA PnP support.
- Simplify PnP enumerator interface.
- Improve module/object searching.
- Add missing depend/install targets in BTX makefiles.
- Pass the kernel environment and module data in extended bootinfo fields.
- Add a pointer to the end of the kernel + modules in bootinfo.
- Fix parsing of old-style kernel arguments.


38764 03-Sep-1998 msmith

Bootstrap updates.

- Move some startup code from MD to MI sections
- Add a 'copyout' and some copyout-related functions. These will be
obsoleted when BTX is available for the 386 and the kernel load
area becomes directly addressable.
- Add the ability load an arbitrary file as a module, associating
and arbitrary type string with it. This can be used eg. for loading
splash-screen images etc.
- Add KLD module dependancy infrastructure. We know how to look for
dependancies inside KLD modules, how to resolve these dependancies
and what to do if things go wrong. Only works for a.out at the
moment, due to lack of an MI ELF loader. Attach KLD module information
to loaded modules as metadata, but don't pass it to the kernel (it
can find it itself).
- Load a.out KLD modules on a page boundary. Only pad the a.out BSS
for the kernel, as it may want to throw symbols away. (We might want
to do this for KLD modules too.)
- Allow commands to be hidden from the '?' display, to avoid cluttering
it with things like 'echo'. Add 'echo'.
- Bring the 'prompt' command into line with the parser syntax.
- Fix the verbose 'ls'; it was using an uninitialised stack variable.
- Add a '-v' flag to 'lsmod' to have it display module metadata as well
(not terribly useful for the average user)
- Support a 'module searchpath' for required modules.
- The bootstrap file on i386 is now called 'loader' to permit the
/boot directory to use that name.
- Discard the old i386 pread() function, as it's replaced by
arch_readin()


38712 31-Aug-1998 msmith

Bootloader update.

- Implement a new copyin/readin interface for loading modules.
This allows the module loaders to become MI, reducing code duplication.
- Simplify the search for an image activator for the loaded kernel.
- Use the common module management code for all module metadata.
- Add an 'unload' command that throws everything away.
- Move the a.out module loader to MI code, add support for a.out
kld modules.

Submitted by: Alpha changes fixed by Doug Rabson <dfr@freebsd.org>


38466 21-Aug-1998 msmith

This commit was generated by cvs2svn to compensate for changes in r38465,
which included commits to RCS files with non-trunk default branches.


38465 21-Aug-1998 msmith

This is the new unified bootstrap, sometimes known previously as the
'three-stage' bootstrap.
There are a number of caveats with the code in its current state:
- The i386 bootstrap only supports booting from a floppy.
- The kernel and kld do not yet know how to deal with the extended
information and module summary passed in.
- PnP-based autodetection and demand loading of modules is not implemented.
- i386 ELF kernel loading is not ready yet.
- The i386 bootstrap is loaded via an ugly blockmap.

On the alpha, both net- and disk-booting (SRM console machines only) is
supported. No blockmaps are used by this code.

Obtained from: Parts from the NetBSD/i386 standalone bootstrap.