Commit Graph

2252 Commits

Author SHA1 Message Date
Marcel Moolenaar
592daa5d9b Remove debugging printf(). There's no need to print the image
base address anymore.
2010-01-10 00:14:04 +00:00
Marcel Moolenaar
716f79c093 Remove file system support based on the simple file system protocol
as this only allows us to access file systems that EFI knows about.
With a loader that can only use EFI-supported file systems, we're
forced to put /boot on the EFI system partition. This is suboptimal
in the following ways:
1.  With /boot a symlink to /efi/boot, mergemaster complains about
    the mismatch and there's no quick solution.
2.  The EFI loader can only boot a single version of FreeBSD. There's
    no way to install multiple versions of FreeBSD and select one
    at the loader prompt.
3.  ZFS maintains /boot/zfs/zpool.cache and with /boot a symlink we
    end up with the file on a MSDOS file system. ZFS does not have
    proper handling of file systems that are under Giant.

Implement a disk device based on the block I/O protocol instead and
pull in file system code from libstand. The disk devices are really
the partitions that EFI knows about.

This change is backward compatible.

MFC after:	1 week
2010-01-09 22:54:29 +00:00
Marius Strobl
ccb1921ee0 - Add code allowing a network device to only be open and closed once
by keeping it opened after the first open and closing it via the
  cleanup handler when NETIF_OPEN_CLOSE_ONCE is defined in order to
  avoid the open-close-dance on every file access which with firmware
  that for example performs an auto-negotiation on every open causes
  netbooting to take horribly long. Basically the behavior with this
  knob enabled resembles the one employed between r60506 and r177108
  (and for sparc64 also again since r182919) with the addition that
  the network device now is closed eventually before entering the
  kernel and before rebooting. Actually I think this should be the
  desired MI behavior, however the U-Boot loader actually requires
  net_close() to be called after every transaction in order for some
  local shutdown operations to be performed (and which I think thus
  will break on concurrent opens, i.e. when netdev_opens is > 1, like
  the loader does at least for disks when LOADER_GZIP_SUPPORT is
  enabled).
- Use NETIF_OPEN_CLOSE_ONCE to replace the hack, which artificially
  increased netdev_opens for sparc64 in order to keep the network
  device opened forever, as at least some firmware versions require
  the network device to be closed eventually before entering the
  kernel or otherwise will DMA received packets to stale memory.
  The powerpc OFW loader probably wants NETIF_OPEN_CLOSE_ONCE to be
  set as well for the same reasons.
2010-01-09 21:23:39 +00:00
Marius Strobl
989bac19ea Remove clause 3 and 4 from TNF licenses (this was the only 4-clause TNF
license FreeBSD had in sys/boot).

Obtained from:	NetBSD
2010-01-09 17:09:57 +00:00
Xin LI
6f2c3084b5 Space cleanup for revision 201689 committed separately for easier review.
This commit is purely space changes.

Submitted by:	Matt Reimer
Sponsored by:	VPOP Technologies, Inc.
MFC after:	2 weeks
2010-01-06 23:11:56 +00:00
Xin LI
03ec6213ee Instead of assuming all vdevs are healthy, check the newest vdev label
for each vdev's status.  Booting from a degraded vdev should now be
more robust.

Submitted by:	Matt Reimer <mattjreimer at gmail.com>
Sponsored by:	VPOP Technologies, Inc.
MFC after:	2 weeks
2010-01-06 23:09:23 +00:00
Martin Blapp
1457e0cdac Fix typo: s/partion/partition/
Submitted by:	Marc Balmer <marc@msys.ch>
MFC after:	3 days
2010-01-02 17:32:40 +00:00
Yoshihiro Takahashi
02694ba6bc Reimplement the boot2 for pc98 completely.
It's based on the newest i386's one and has the advantage of:

 - ELF binary support.
 - UFS2 filesystem support.
 - Many FreeBSD slices support on a disk.

Tested by:	SATOU Tomokazu ( tomo1770 _ maple _ ocn _ ne _ jp ),
		WATANABE Kazuhiro ( CQG00620 _ nifty _ ne _ jp ) and
		nyan

MFC after:	2 week

Happy New Year in Japan!!
2009-12-31 15:03:33 +00:00
Yoshihiro Takahashi
5c44b2a6b3 Don't use 15M-16M area on pc98. It's reserved for some devices.
MFC after:	2 week
2009-12-31 12:17:38 +00:00
Yoshihiro Takahashi
6925b4bda1 Add setting machine type support to the loader.
MFC after:	2 week
2009-12-31 12:05:48 +00:00
Antoine Brodin
13e403fdea (S)LIST_HEAD_INITIALIZER takes a (S)LIST_HEAD as an argument.
Fix some wrong usages.
Note: this does not affect generated binaries as this argument is not used.

PR:		137213
Submitted by:	Eygene Ryabinkin (initial version)
MFC after:	1 month
2009-12-28 22:56:30 +00:00
Marius Strobl
005ad6daf8 Execute the cleanup handlers before jumping to the kernel just
like the other architectures do.
2009-12-24 15:23:51 +00:00
Marius Strobl
5e01e025a2 - Consistently wrap debugging in NETIF_DEBUG. This basically merges
NetBSD rev 1.19.
- Make the functions match their prototypes regarding static.
2009-12-24 15:16:16 +00:00
Marius Strobl
4794ebf3b9 Revert r183628 as with the current ata(4) ATAPI DMA with AcerLabs
M5229 appears to be once again fixed. If this happens to return
we probably should disable ATAPI DMA in ataacerlabs(4) instead
just like the Linux libATA does.
2009-12-24 15:14:35 +00:00
John Baldwin
b677f368bb Don't build zfsboot, gptzfsboot, and zfsloader if WITHOUT_ZFS is enabled.
MFC after:	1 week
2009-12-22 20:56:33 +00:00
Yoshihiro Takahashi
db5dd5cff8 Move cursor position after putting a character.
MFC after:	1 week
2009-12-21 14:59:23 +00:00
Marcel Moolenaar
e7f42eade6 Fix ub_env_enum(): syscall() returns 0 when properly invoked. 2009-12-18 21:12:37 +00:00
Yoshihiro Takahashi
ef7b7ac106 Fix debug messages of bd_io().
MFC after:	1 week
2009-12-17 13:14:11 +00:00
Marcel Moolenaar
066b1a5c7b Add support for memory disk (md). The size of the memory disk
is determined by MD_IMAGE_SIZE. A file system can be embedded
into the loader with /sys/tools/embed_mfs.sh.
Note that md.c is not included when MD_IMAGE_SIZE is not set.
2009-12-13 01:20:32 +00:00
Yoshihiro Takahashi
36ff75683a Cleanups the boot2 for pc98. There is no functional change.
- Make setting machine type and getting geom conditional for future.
  - Remove unused RAWBOOT and CDBOOT supports.
  - Remove unneeded include.
  - Fix warnings.

MFC after:	1 week
2009-12-11 12:36:59 +00:00
John Baldwin
e85b664cd2 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
2009-12-10 14:54:29 +00:00
John Baldwin
23e00c4d81 Fix a confusing typo in the EDD packet structure used in gptboot and
gptzfsboot.  I got the segment and offset fields reversed in the structure,
but I also succeeded in crossing the assignments so the actual EDD packet
ended up correct.

MFC after:	1 week
2009-12-09 21:09:32 +00:00
John Baldwin
4497287f20 - Port bios_getmem() from libi386 to {gpt,}zfsboot() and use it to
safely allocate a heap region above 1MB.  This enables {gpt,}zfsboot()
  to allocate much larger buffers than before.
- Use a larger buffer (1MB instead of 128K) for temporary ZFS buffers.  This
  allows more reliable reading of compressed files in a raidz/raidz2 pool.

Submitted by:	Matt Reimer  mattjreimer of gmail
MFC after:	1 week
2009-12-09 20:36:56 +00:00
Yoshihiro Takahashi
1a800d321e MFi386: revision 200219
Improve the algorithm the loader uses to choose a memory range for its
  heap when using a range above 1MB.

MFC after:	1 week
2009-12-08 13:06:35 +00:00
Yoshihiro Takahashi
ff85a22cfd MFi386: Use real mode instead of v86 mode.
MFC after:	1 week
2009-12-08 13:04:26 +00:00
Yoshihiro Takahashi
e61de1d24c MFi386: revision 200216
Various small whitespace and style fixes.
2009-12-08 12:10:06 +00:00
John Baldwin
f1a6fd5d07 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
2009-12-07 16:29:43 +00:00
John Baldwin
eddb3f5b88 Various small whitespace and style fixes. 2009-12-07 16:00:59 +00:00
Maxim Sobolev
5d695da1d7 Remove spinconsole from pc98, some parts seem to be missed and it's
too late (early?) to figure out what exactly.

Reported by:	TAKAHASHI Yoshihiro
2009-11-27 13:19:06 +00:00
Maxim Sobolev
12ff431c6c Whitespace-only: another instance of identation with spaces. 2009-11-27 04:00:52 +00:00
Maxim Sobolev
8e67cba0d8 Whitespace on: use tabs for identation consistently. 2009-11-27 03:58:21 +00:00
Maxim Sobolev
c4c3b35172 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.
2009-11-27 03:55:42 +00:00
Edward Tomasz Napierala
27565a4094 Be nice, don't use the f-word. 2009-11-25 16:36:07 +00:00
Robert Noland
f06c961ee3 Create a seperate ZFS enabled loader.
This adds zfsloader which will be called by zfsboot/gptzfsboot code rather
than the tradional loader.  This eliminates the need to set the
LOADER_ZFS_SUPPORT variable in order to get a ZFS enabled loader.

Note however, that you must reinstall your bootcode (zfsboot/gptzfsboot)
in order for the boot process to use the new loader.

New installations will no longer be required to build a ZFS enabled
loader for a working ZFS boot system.  Installing zfsboot/gptzfsboot is
sufficient for acknowledging the use of CDDL code and therefore the ZFS
enabled loader.

Based on a previous patch from jhb@

Reviewed by:	jhb@
MFC after:	2 weeks
2009-11-23 16:00:16 +00:00
John Baldwin
c6858769af Always use 64-bit LBAs for disk addresses in zfsboot and gptzfsboot to
fully support booting from large volumes.

Tested by:	Emil Smolenski  ambsd of raisa.eu.org
Submitted by:	Matt Reimer  mattjreimer of gmail (most of the C bits)
MFC after:	1 week
2009-11-20 12:48:35 +00:00
Rafal Jaworowski
035622ef18 Provide an effective (relocated) address when building modules metadata.
This lets modules loaded dynamically in loader(8) work for U-Boot-based
platforms.

MFC after:	1 week
2009-11-19 16:25:41 +00:00
Attilio Rao
909feda120 Introduce a new option (BOOT_PROMPT_123) that lets enter the boot prompt
only when typing the sequence "123" (opposite to the standard 'push any
button' approach).
That results useful when using serial lines sending garbage and leading
to unwilling boot prompt appearence.

Obtained from:	Sandvine Incorporated
Reviewed by:	emaste, jhb
Sponsored by:	Sandvine Incorporated
MFC:		1 week
2009-11-12 01:30:17 +00:00
Antoine Brodin
18ca996c25 - Remove trailing ";" after if statement
- Remove #if 0 section that was never needed/used

Reviewed by:	raj@
MFC after:	1 month
2009-11-11 19:39:45 +00:00
Christian Brueffer
b3fb748ccf Close a file descriptor leak in an error case.
PR:		138374
Submitted by:	Patroklos Argyroudis <argp@census-labs.com>
MFC after:	1 week
2009-10-28 10:06:27 +00:00
Robert Noland
14c436e101 Correct some issues with zfs boot.
- Teach it to read gang blocks. (essentially untested)
   If you see "ZFS: gang block detected!", please let
   me know, so we can either remove the printf if it
   works, or fix it if it doesn't.

 - If multiple partitions exist on a disk, probe them all.
   We also need to reset dsk->start to 0 to read the right
   sector here.

 - With GPT, we can have 128 partitions.

 - If the bootfs property has ever been set on a pool
   it seems that it never goes away.  zpool won't allow
   you to add to the pool with the bootfs property set.
   However, if you clear the property back to default
   we end up getting 0 for the object number and read
   a bogus block pointer and fail to boot.

 - Fix some error printfs. The printf in the loader is
   only capable of c,s and u formats.

 - Teach printf how to display %llu

Reviewed by:	dfr, jhb
MFC after:	2 weeks
2009-10-23 18:44:53 +00:00
John Baldwin
a944fb4cc3 Use zfs_read() instead of xfsread() to read /boot.config. xfsread() fails
short read requests, so the result was that a /boot.config smaller than 512
bytes was ignored.  boot2 uses fsread() instead of xfsread() to read
/boot.config already, so this makes zfsboot more like boot2.

Submitted by:	Johny Mattsson  johny-freebsd of earthmagic org
Reviewed by:	dfr
MFC after:	3 days
2009-10-14 14:13:42 +00:00
Bjoern A. Zeeb
4507f02e0e lindev(4) [1] is supposed to be a collection of linux-specific pseudo
devices that we also support, just not by default (thus only LINT or
module builds by default).

While currently there is only "/dev/full" [2], we are planning to see more
in the future.  We may decide to change the module/dependency logic in the
future should the list grow too long.

This is not part of linux.ko as also non-linux binaries like kFreeBSD
userland or ports can make use of this as well.

Suggested by:	rwatson [1] (name)
Submitted by:	ed [2]
Discussed with:	markm, ed, rwatson, kib (weeks ago)
Reviewed by:	rwatson, brueffer (prev. version)
PR:		kern/68961
MFC after:	6 weeks
2009-09-26 12:45:28 +00:00
Yoshihiro Takahashi
e63445f340 MFi386:
Move the loader's entry point to 0x200000.  This change is also needed
for pc98.

MFC after:	3 days
2009-09-13 11:20:17 +00:00
Ed Maste
58564ca597 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
2009-09-10 22:05:43 +00:00
John Hay
e8c91ce393 Fix parse() so that the partition to boot (load /boot/loader) from can
be set. The syntax as printed in main() is used: 0:ad(0p3)/boot/loader

Reviewed by:	jhb
Approved by:	re (kib)
2009-08-17 15:19:03 +00:00
Bjoern A. Zeeb
d0ea47437a Update epair(4) to the new netisr implementation and polish
things a bit:
- use dpcpu data to track the ifps with packets queued up,
- per-cpu locking and driver flags
- along with .nh_drainedcpu and NETISR_POLICY_CPU.
- Put the mbufs in flight reference count, preventing interfaces
  from going away, under INVARIANTS as this is a general problem
  of the stack and should be solved in if.c/netisr but still good
  to verify the internal queuing logic.
- Permit changing the MTU to virtually everythinkg like we do for loopback.

Hook epair(4) up to the build.

Approved by:	re (kib)
2009-07-26 12:20:07 +00:00
Rui Paulo
1e5fd3f467 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)
2009-06-26 09:32:31 +00:00
Rafal Jaworowski
400b1bbfe8 Bump PowerPC loader(8) version to reflect extensions it has recently grown. 2009-06-22 15:57:12 +00:00
Marius Strobl
119051cbf9 Add cas(4), a driver for Sun Cassini/Cassini+ and National Semiconductor
DP83065 Saturn Gigabit Ethernet controllers. These are the successors
of the Sun GEM controllers and still have a similar but extended transmit
logic. As such this driver is based on gem(4).
Thanks to marcel@ for providing a Sun Quad GigaSwift Ethernet UTP (QGE)
card which was vital for getting this driver to work on architectures
not using Open Firmware.

Approved by:	re (kib)
MFC after:	2 weeks
2009-06-15 18:22:41 +00:00
Pyun YongHyeon
d68875eb7e Add alc(4), a driver for Atheros AR8131/AR8132 PCIe ethernet
controller. These controllers are also known as L1C(AR8131) and
L2C(AR8132) respectively. These controllers resembles the first
generation controller L1 but usage of different descriptor format
and new register mappings over L1 register space requires a new
driver. There are a couple of registers I still don't understand
but the driver seems to have no critical issues for performance and
stability. Currently alc(4) supports the following hardware
features.
  o MSI
  o TCP Segmentation offload
  o Hardware VLAN tag insertion/stripping
  o Tx/Rx interrupt moderation
  o Hardware statistics counters(dev.alc.%d.stats)
  o Jumbo frame
  o WOL
AR8131/AR8132 also supports Tx checksum offloading but I disabled
it due to stability issues. I'm not sure this comes from broken
sample boards or hardware bugs. If you know your controller works
without problems you can still enable it. The controller has a
silicon bug for Rx checksum offloading, so the feature was not
implemented.
I'd like to say big thanks to Atheros. Atheros kindly sent sample
boards to me and answered several questions I had.

HW donated by:	Atheros Communications, Inc.
2009-06-10 02:07:58 +00:00
John Baldwin
0cf7495c65 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
2009-06-08 15:09:22 +00:00
John Baldwin
2a4eff4703 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
2009-06-08 15:07:35 +00:00
Jung-uk Kim
129d3046ef Import ACPICA 20090521. 2009-06-05 18:44:36 +00:00
Rafal Jaworowski
f439325342 Make GPT style partitiong endian-safe in U-Boot support library.
Submitted by:	Piotr Ziecik
Obtained from:	Semihalf
2009-06-03 16:28:29 +00:00
John Baldwin
4fdf20550c Add a missing parameter when displaying GPT partitions with an unknown
UUID.

Submitted by:	Pawel Worach  pawel.worach | gmail
MFC after:	1 week
2009-06-01 14:20:13 +00:00
Craig Rodrigues
0c349f0856 sys/boot/common.c
=================
Extend the loader to parse the root file system mount options in /etc/fstab,
and set a new loader variable vfs.root.mountfrom.options with these options.
The root mount options must be a comma-delimited string, as specified in
/etc/fstab.
Only set the vfs.root.mountfrom.options variable if it has not been
set in the environment.

sys/kern/vfs_mount.c
====================
When mounting the root file system, pass the mount options
specified in vfs.root.mountfrom.options, but filter out "rw" and "noro",
since the initial mount of the root file system must be done as "ro".
While we are here, try to add a few hints to the mountroot prompt
to give users and idea what might of gone wrong during mounting
of the root file system.

Reviewed by:	jhb (an earlier patch)
2009-06-01 01:02:30 +00:00
Marcel Moolenaar
7a6c5e0bb1 Fix NETIF_DEBUG compilation. 2009-05-30 19:28:38 +00:00
Doug Rabson
cc4757ddef Some of the boot loader code only works on a ufs file system, but it
uses the generic struct dirent, which happens to look identical to UFS's
struct direct.  If BSD ever changes dirent then this will be a problem.

Submitted by:	matthew dot fleming at isilon dot com
2009-05-28 08:22:36 +00:00
Christian Brueffer
395ad99417 Improve the accf_dns_load description. 2009-05-17 10:58:50 +00:00
Doug Rabson
e1899ef6c8 Add support for booting from raidz1 and raidz2 pools. 2009-05-16 10:48:20 +00:00
Rafal Jaworowski
91e8591acd GPT style partitioning for loader(8) with U-Boot support library (tested on
ARM).

Submitted by:	Piotr Ziecik kosmo ! semihalf dot com
2009-05-05 16:29:08 +00:00
Jung-uk Kim
cebe9dc98a 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
2009-04-15 17:31:22 +00:00
Marius Strobl
24b847f1f0 Fix masking of TTE bits; the TD_*_MASK macros need shifting via the
corresponding TD_*_SHIFT.

MFC after:	3 days
2009-04-14 19:02:34 +00:00
John Baldwin
087ebb8a5c 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
2009-04-14 14:19:18 +00:00
Marius Strobl
b7f089e9f1 Fix whitespace. 2009-04-13 19:43:37 +00:00
Jung-uk Kim
ac5c83d9f3 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.
2009-04-07 17:58:15 +00:00
Jung-uk Kim
d4e77db18b Increase sprintf(3) buffer size, which I forgot from the previous commit. 2009-04-07 17:24:25 +00:00
Weongyo Jeong
9284d50989 Add an entry for the uath(4) module. 2009-04-07 01:37:50 +00:00
Jung-uk Kim
938608cb45 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
2009-03-31 21:02:55 +00:00
Yoshihiro Takahashi
b5ca553462 Oops, fix the previous change. 2009-03-20 13:03:33 +00:00
Yoshihiro Takahashi
d0680af004 MFi386: r189749
Teach the BIOS CD driver to use bounce buffers when the destination
  address is > 1 MB.
2009-03-20 12:26:42 +00:00
Yoshihiro Takahashi
e4cc6edfc1 Merge the missing changes from i386.
Teach the loader about the FAT partitions.
2009-03-20 05:33:58 +00:00
Yoshihiro Takahashi
43d1b8129c MFi386: the part of r179825 to reduce diffs against i386. 2009-03-20 05:21:29 +00:00
Andrew Thompson
2b78d30630 Remove the uscanner(4) driver, this follows the removal of the kernel scanner
driver in Linux 2.6. uscanner was just a simple wrapper around a fifo and
contained no logic, the default interface is now libusb (supported by sane).

Reviewed by:	HPS
2009-03-19 20:33:26 +00:00
Yoshihiro Takahashi
abadd1494d Reduce diffs against i386. 2009-03-19 13:53:42 +00:00
Yoshihiro Takahashi
1214222676 Use the common PC98_MID_* defines instead of a magic number. 2009-03-19 12:33:37 +00:00
Dmitry Chagin
6465d2d9d2 Chase the k8temp->amdtemp rename in NOTES and loader.conf.
Approved by:	kib (mentor)
2009-03-16 10:36:24 +00:00
John Baldwin
47193e464b 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
2009-03-12 20:41:52 +00:00
John Baldwin
49e81dc952 - 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
2009-03-09 17:16:29 +00:00
Marcel Moolenaar
20b2c39f0c Revert the part of change 107879 that employs the unused bytes after
the disklabel in the 2nd sector for boot code. Even with both UFS1
and UFS2 supported, there's enough bytes left that we don't have to
nibble from the disklabel.
Thus, the entire 2nd sector is now reserved for the disklabel, which
makes the bootcode compatible again with disklabels that have more
than 8 partitions -- such as those created and supported by gpart.

i386: 135 bytes available
amd64: 151 bytes available

Ok'd by: jhb
2009-03-07 22:05:58 +00:00
John Baldwin
2cf997a261 Fix some more issues with the real mode BTX.
The old BTX passed the general purpose registers from the 32-bit client to
the routines called via virtual 86 mode.  The new BTX did the same thing.
However, it turns out that some instructions behave differently in virtual 86
mode and real mode (even though this is under-documented).  For example, the
LEAVE instruction will cause an exception in real mode if any of the upper
16-bits of %ebp are non-zero after it executes.  In virtual 8086 mode the
upper 16-bits are simply ignored.  This could cause faults in hardware
interrupt handlers that inherited an %ebp larger than 0xffff from the 32-bit
client (loader, boot2, etc.) while running in real mode.

To fix, when executing hardware interrupt handlers provide an explicit clean
state where all the general purpose and segment registers are zero upon
entry to the interrupt handler.  While here, I attempted to simplify the
control flow in the 'intusr' code that sets up the various stack frames
and exits protected mode to invoke the requested routine via real mode.

A huge thanks to Tor Egge (tegge@) for debugging this issue.

Submitted by:	tegge
Reviewed by:	tegge
Tested by:	bz
MFC after:	1 week
2009-02-24 23:11:15 +00:00
Ruslan Ermilov
d9ca85fca7 Fix build when WITH_SSP is set explicitly.
Submitted by:	Jeremie Le Hen
2009-02-21 15:04:31 +00:00
Warner Losh
7d11259539 Enable building of ficl on MIPS. It compiles, but needs more testing. 2009-02-19 18:53:08 +00:00
Warner Losh
962cd8ffd7 Add basic mips support. This has been compile tested only. 2009-02-19 18:52:31 +00:00
Andrew Thompson
d842ade9a4 Add a helper function for loading geli keys from the loader. 2009-02-16 02:42:17 +00:00
Marius Strobl
ceab1bee37 - Use the generally more appropriate PROM base rather than the
kernel one as the non-faulting flush address in the loader so
  we can can change KERNBASE and VM_MIN_KERNEL_ADDRESS if we
  ever want to without needing to worry about using a compatible
  loader.
- Correctly check for LOADER_DEBUG.
- Add a missing const for page_sizes[].
2009-02-10 21:48:42 +00:00
Gabor Kovesdan
d3e084d2cf - Remove superfluous comment
PR:		docs/129400
Submitted by:	Gavin Atkinson <gavin@freebsd.org>
2009-01-30 15:27:04 +00:00
Weongyo Jeong
0d5245c817 Add an entry for the urtw(4) module. 2009-01-23 05:56:09 +00:00
Luigi Rizzo
3f2721ea44 remove a file which is, as far as I can tell, totally unused. 2009-01-13 22:15:47 +00:00
Luigi Rizzo
2ca710fbbc comment out some debugging messages that slipped in by mistake.
MFC after:	3 days
2009-01-13 12:28:14 +00:00
Jung-uk Kim
88a82e34f7 Allow VIA Nano processors to boot FreeBSD/amd64.
PR:		amd64/130303
MFC after:	1 week
2009-01-12 16:28:19 +00:00
Luigi Rizzo
065188a630 This patch introduces a number of simplifications to the Forth
functions used in the bootloader. The goal is to make the code more
readable and smaller (especially because we have size issues
in the loader's environment).

High level description of the changes:
+ define some string manipulation functions to improve readability;
+ create functions to manipulate module descriptors, removing some
  duplicated code;
+ rename the error codes to ESOMETHING;
+ consistently use set_environment_variable (which evaluates
  $variables) when interpreting variable=value assignments;

I have tested the code, but there might be code paths that I have
not traversed so please let me know of any issues.

Details of this change:

--- loader.4th ---
+ add some module operators, to remove duplicated code while parsing
  module-related commands:

        set-module-flag
        enable-module
        disable-module
        toggle-module
        show-module

--- pnp.4th ---
+ move here the definition related to the pnp devices list, e.g.
  STAILQ_* , pnpident, pnpinfo

--- support.4th ---
+ rename error codes to capital e.g. ENOMEM EFREE ... and do obvious
  changes related to the renaming;
+ remove unused structures (those relevant to pnp are moved to pnp.4th)
+ various string functions
  - strlen removed (it is an internal function)
  - strchr, defined as the C function
  - strtype -- type a string to output
  - strref -- assign a reference to the string on the stack
  - unquote -- remove quotes from a string

+ remove reset_line_buffer

+ move up the 'set_environment_variable' function (which now
  uses the interpreter, so $variables are evaluated).
  Use the function in various places

+ add a 'test_file function' for debugging purposes

MFC after:	4 weeks
2009-01-05 20:09:54 +00:00
Luigi Rizzo
df52a87993 A number of small changes to make the 'save choice to disk' safer,
and re-enable it as default.

In particular:

+ re-enable the 'update' flag in the Makefile (of course!);

+ commit Warner's patch "orb $NOUPDATE,_FLAGS(%bp)"
  to avoid writing to disk in case of a timeout/default choice;

+ fix an off-by-one count in the partition scan code that would
  print the wrong name for unknown partitions;

+ unconditionally change the boot prompt to 'Boot:' instead of 'Default:'
  to make room for the extra code/checks/messages. Some of the changes
  listed below are also made to save space;

+ rearrange and fix comments for known partition types. Right now we
  explicitly recognise *BSD, Linux, FAT16 (type 6, used on many USB keys),
  NTFS (type 7), FAT32 (type 11).
  Depending on other options we also recognise Extended (type 5),
  FAT12 (type 1) and FAT16 < 32MB (type 4).

+ Add an entry "F6 PXE" when the code is built with -DPXE (which is
  a default now). Technically, F6 boots through INT18, so the prompt 'PXE'
  is a bit misleading. Unfortunately the name INT18
  is too long and does not fit in - we could use ROM perhaps.
  The reason I picked 'PXE' is that on many (I believe) new systems
  INT18 calls PXE.

Apart from the choice of the name for PXE/ROM/INT18, this should close
pending issues on the 1-sector boot0 code and we should be able to
move the code to RELENG_7 when it reopens.

No boot0cfg changes are necessary.

MFC after:	3 weeks
2008-12-30 09:40:50 +00:00
Sam Leffler
41fe50f5de MFH @ 186335 2008-12-20 01:29:19 +00:00
Sam Leffler
656c23db6e add delays around 16-bit enable/disable a la the driver; w/o this
operation on my ixp435 Cambria board is unreliable
2008-12-19 00:56:47 +00:00
Doug Rabson
7b3569ff05 Use full 64bit arithmetic when converting file offsets to block numbers - fixes
booting on filesystems with inode numbers with values above 4194304.

Submitted by:	ps
2008-12-17 18:12:01 +00:00
Rafal Jaworowski
845a6f19d2 Improve style(9) in PowerPC U-Boot support lib. 2008-12-17 15:58:07 +00:00
Yoshihiro Takahashi
aa22b26643 Disconnect the efi from pc98. It's not needed. 2008-12-14 02:57:41 +00:00
Sam Leffler
4173c22644 merge WIP multi-board support; tested on Avila and Cambria, still
needs Proghorn testing
2008-12-13 02:56:08 +00:00
Paul Saab
5ee5aed0a3 Fix a leak introduced in r185902. We should free the devspec if
we've successfully found a zfs pool.
2008-12-11 16:48:35 +00:00
Paul Saab
390edcc5b9 Avoid a double free in devopen by not freeing the device structure
in zfs_dev_open.  This stops a panic in the loader when trying to
read from a zfs device and no zfs devices exist.
2008-12-11 02:23:49 +00:00
Doug Rabson
937a012e5d Don't get confused if we encounter a device which is part of a raidz or raidz2
pool while probing for vdevs.

PR:		129539
Submitted by:	Paul Wootton (paul at fletchermoorland dot co dot uk)
2008-12-10 10:46:34 +00:00
Maxim Sobolev
bce289fa28 Remove now unused label.
Submitted by:	Christoph Mallon
MFC after:	4 weeks
		(along with r185779 and r185780)
2008-12-09 00:25:57 +00:00
Maxim Sobolev
55641d8353 Optimiza assembly in the previous r185779, to save whooping 16 bytes.
Submitted by:	Christoph Mallon
MFC after:	4 weeks
		(including r185779)
2008-12-08 23:45:41 +00:00
Maxim Sobolev
e110108d3e Respect RBX_MUTE flag from boot[012].
MFC after:	4 weeks
2008-12-08 21:52:06 +00:00
Maxim Sobolev
a6d94c502c Fix typo in the comment %is -> %si. 2008-12-08 20:53:27 +00:00
Luigi Rizzo
5e5391084a PROBLEM: putting in a loader config file a line of the form
loader_conf_files="foo bar baz"

should cause loading the files listed, and then resume with the
remaining config files (from previous values of the variable).
Unfortunately, sometimes the line was ignored -- actually even
modifying the line in /boot/default/loader.conf  sometimes doesn't work.

ANALYSIS: After much investigation, turned out to be a bug in the logic.
The existing code detected a new assignment by looking at the address
of the the variable containing the string. This only worked by pure
chance, i.e. if the new string is longer than the previous value
then the memory allocator may return a different address
to store the string hence triggering the detection.

SOLUTION: This commit contains a minimal change to fix the problem,
without altering too much the existing structure of the code.
However, as a step towards improving the quality and reliability of
this code, I have introduced a handful of one-line functions
(strget, strset, strfree, string= ) that could be used in dozens
of places in the existing code.

HOWEVER:
There is a much bigger problem here. Even though I am no Forth
expert (as most fellow src committers) I can tell that much of the
forth code (in support.4th at least) is in severe need of a
review/refactoring:

+ pieces of code are replicated multiple times instead of writing
  functions (see e.g.  set_module_*);

+ a lot of stale code (e.g. "structure" definitions for
  preloaded_files, kernel_module, pnp stuff) which is not used
  or at least belongs elsewhere.
  The code bload is extremely bad as the loader runs with very small
  memory constraints, and we already hit the limit once (see

    http://svn.freebsd.org/viewvc/base?view=revision&revision=185132
  Reducing the footprint of the forth files is critical.

+ two different styles of coding, one using pure stack functions
  (maybe beautiful but surely highly unreadable), one using
  high level mechanisms to give names to arguments and local
  variables (which leads to readable code).

Note that this code is used by default by all FreeBSD installations,
so the fragility and the code bloat are extremely damaging.
I will try to work fixing the three items above, but if others have
time, please have a look at these issues.

MFC after:	4 weeks
2008-12-07 19:42:20 +00:00
Paul Saab
8f6a8ed553 Correct include path for i386 specific includes. This allows zfs
to boot on systems where the loader is built on amd64 systems.
2008-12-06 14:45:03 +00:00
Daniel Gerzo
f1f8583397 - correct variable name
PR:		docs/129448
Submitted by:	Kenyon Ralph <kralph@gmail.com>
MFC after:	Revision 1.91 is merged
2008-12-06 11:21:10 +00:00
Luigi Rizzo
ae3096705c Another, hopefully final set of changes to boot0 and boot0cfg.
boot0.S changes:

+ import a patch from Christoph Mallon to rearrange the various
  print functions and save another couple of bytes;

+ implement the suggestion in PR 70531 to enable booting from
  any valid partition because even the extended partitions that
  were previously in our kill list may contain a valid boot loader.
  This simplifies the code and saves some bytes;

+ followwing up PR 127764, implement conditional code to preserve
  the 'Volume ID' which might be used by other OS (NT, XP, Vista)
  and is located at offset 0x1b8. This requires a relocation of the
  parameter block within the boot sector -- there is no other
  possible workaround.
  To address this, boot0cfg has been updated to handle both
  versions of the boot code;

+ slightly rearrange the strings printed in the menus to make
  the code buildable with all options. Given the tight memory
  budget, this means that with certain options we need to
  shrink or remove certain labels.

and especially:

	make -DVOLUME_LABEL -DPXE the default options.

  This means that the newly built boot0 block will preserve the
  Volume ID, and has the (hidden) option F6 to boot from INT18/PXE.
  I think the extra functionality is well worth the change.

  The most visible difference here is that the 'Default: ' string
  now becomes 'Boot: ' (it can be reverted to the old value
  but then we need to nuke 1/2 partition name or entries to
  make up for the extra room).

boot0cfg changes:

+ modify the code to recognise the new boot0 structure (with the
  relocated options block to make room for the Volume id).

+ add two options, '-i xxxx-xxxx' to set the volume ID, -e c
  to modify the character printed in case of bad input

PR:		127764 70531
Submitted by:	Christoph Mallon (portions)
MFC after:	4 weeks
2008-12-03 14:53:59 +00:00
Luigi Rizzo
4b91bf7948 This commits brings in a lot of documentation and some enhancement
of the boot0.S code, with a number of compile-time selectable options,
the most interesting one being the ability to select PXE booting.

The code is completely compatible with the previous one, and with
the boot0cfg program. Even the actual code is largely unmodified,
with only minor rearrangements or fixes to make room for the new
features.

The behaviour of the standard build differs from the previous
version in the following, minor things:

+ 'noupdate' is the default, which means the code does not
  write back the selection to disk. You can enable the feature
  at runtime with boot0cfg, or changing the flags in the Makefile.

+ a drive number of 0x00 (floppy, or USB in floppy emulation) is
  now accepted as valid. Previously, it was overridden with 0x80,
  meaning that the partition table coming from the media was
  used to access sectors on a possibly different media.
  You can revert to the previous mode building with -DCHECK_DRIVE,
  and you can always use the 'setdrv' option in boot0cfg

+ certain FAT or NTFS partitions are listed as WIN instead of DOS.

+ the 'bel' character on a bad selection is replaced by a '#' to
  make it clear that the system is not hang even if the machine
  does not have a speaker. This can be reverted back at compile
  time, or at runtime with an upcoming boot0cfg option.

Additional features are available as compile time options,
and may be become the default if deemed useful. In particular:

+ INT18/PXE boot (make -DPXE)
  This option enables booting through INT 18h (which on certain
  BIOSes can be hooked to PXE) by pressing F6. There is unfortunately
  no room to print the additional menu option.
  Also, to make room for the code, the 'Default: ' string is
  changed to 'Boot: '

+ print current drive number (make -DTEST)
  Prints a line indicating the current drive number.
  This is useful to figure out what is going on for machines/bioses
  which remap drives in sometimes surprising ways.

+ disable numeric keys in console mode (make -DONLY_F_KEYS)
  Not really a significant option, but it is needed to make
  room for the -DTEST mode.

+ disable floppy support (make -DCHECK_DRIVE)
  Revert to the old behaviour of only accepting 0x80 and above
  as valid drive numbers.

MFC after:	6 weeks
2008-12-02 14:57:48 +00:00
Rafal Jaworowski
8504549387 Let ARM loader(8) build with the man page. 2008-11-27 16:53:01 +00:00
Luigi Rizzo
86d6c2d4b9 Fix a typo in previous commit: must call "putn" to print a crlf,
instead of "puts" which prints whatever is at %si, followed by a CRLF.

It was not noticed during tests because at that point %si points
to a partition entry whose first byte is 0x80, which is both a
terminator for the string and a non printable character.

Submitted by:	Christoph Mallon
2008-11-26 21:38:43 +00:00
Luigi Rizzo
54dd5ca200 Pass the pointer to the selected partition in %si to the next stage
boot code. The bug was introduced in rev.1.13, and went unnoticed
because FreeBSD's boot1 does not use it, but other systems might.

(I have been struggling for almost a full day trying to figure out
why a syslinux'ed partition would not boot when started with the
FreeBSD /boot/boot0, only to realize that the bug was ours!)

The space for the two extra bytes (push %si and pop %si) is reclaimed
by removing an extra CRLF that is printed before booting.

The bug is not a major one but if there is time it might be a good
thing to merge it into the upcoming releases.
2008-11-26 18:01:21 +00:00
Doug Rabson
ebd4055a33 Fix amd64 build and re-enable gptzfsboot. 2008-11-22 14:24:55 +00:00
Dag-Erling Smørgrav
265e36de8c Disconnect gptzfsboot from the build until dfr@ gets his act together. 2008-11-21 08:10:07 +00:00
Luigi Rizzo
ade303f361 As reported in kern/118222, pxeboot in RELENG7 (and presumably
above) exhibits some misbehaviours on machines with AMD64 CPUs,
which at least in some cases I have tracked down to a heap overflow.

It is unclear whether it depends on the CPU or on the pxe bios
itself which may use more memory on AMD machines.

Noticeably a pxeboot compiled from 6.x sources works fine on all
machines I have tried so far, while a pxeboot compiled from 7.x
sources does not.

This patch is a first step in reducing the amount of memory used
while processing the configuration files read by the loader at boot
(some of them are quite large, 1700+ lines), and it does so by:
+ moving a buffer to static memory instead of allocating in the heap;
+ skipping empty lines;
+ reducing the amount of memory used for line descriptors;

Unfortunately there are several changes between 6.x and above,
affecting the compiler, the loader code itself, and libstand,
and it is not so straightforward to
These changes fix the behaviour on one motherboard with a
single-core AMD cpu, but are still not enough e.g on an Asus
M2N-VM (with a dual-core CPU).

I need to investigate the problem a bit more before figuring
out what should be committed to RELENG_7

PR:		kern/118222
2008-11-20 14:57:09 +00:00
Rafal Jaworowski
11cdd0c0c2 Initial storage functionality for U-Boot support library.
- Only non-sliced bsdlabel style partitioning is currently supported (but provisions
  are made towards GPT support, which should follow soon)
- Enable storage support in loader on ARM

Obtained from:	Semihalf
2008-11-19 17:34:28 +00:00
Doug Rabson
0d16312b46 Some zfsboot fixes from Norikatsu Shigemura:
1. zfsboot2 (boot2) doesn't %d (printf), so change %d to %u.
2. chase new zpool versioning as SPA_VERSION.
   Obtained from: sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h

Submitted by:	nork
2008-11-19 16:59:19 +00:00
Doug Rabson
51f0d2e192 Add a GPT-aware variant of zfsboot which should be used in a similar manner
to gptboot, i.e. installed in a freebsd-boot partition using /sbin/gpart or
/sbin/gpt.

Tweak the /boot/loader ZFS support so that it can find ZFS pools that are
contained in GPT partitions.
2008-11-19 16:39:01 +00:00
Doug Rabson
14dddafbb3 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.
2008-11-19 16:04:07 +00:00
Andrey A. Chernov
caab1f000c Fix building without ZFS (can't find library) 2008-11-18 03:55:55 +00:00
Pawel Jakub Dawidek
1ba4a712dd 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
2008-11-17 20:49:29 +00:00
Pyun YongHyeon
3c6e15bcee Add ale(4), a driver for Atheros AR8121/AR8113/AR8114 PCIe ethernet
controller. The controller is also known as L1E(AR8121) and
L2E(AR8113/AR8114). Unlike its predecessor Attansic L1,
AR8121/AR8113/AR8114 uses completely different Rx logic such that
it requires separate driver. Datasheet for AR81xx is not available
to open source driver writers but it shares large part of Tx and
PHY logic of L1. I still don't understand some part of register
meaning and some MAC statistics counters but the driver seems to
have no critical issues for performance and stability.

The AR81xx requires copy operation to pass received frames to upper
stack such that ale(4) consumes a lot of CPU cycles than that of
other controller. A couple of silicon bugs also adds more CPU
cycles to address the known hardware bug. However, if you have fast
CPU you can still saturate the link.
Currently ale(4) supports the following hardware features.
  - MSI.
  - TCP Segmentation offload.
  - Hardware VLAN tag insertion/stripping with checksum offload.
  - Tx TCP/UDP checksum offload and Rx IP/TCP/UDP checksum offload.
  - Tx/Rx interrupt moderation.
  - Hardware statistics counters.
  - Jumbo frame.
  - WOL.

AR81xx PCIe ethernet controllers are mainly found on ASUS EeePC or
P5Q series of ASUS motherboards. Special thanks to Jeremy Chadwick
who sent the hardware to me. Without his donation writing a driver
for AR81xx would never have been possible. Big thanks to all people
who reported feedback or tested patches.

HW donated by:	koitsu
Tested by:	bsam, Joao Barros <joao.barros <> gmail DOT com >
		Jan Henrik Sylvester <me <> janh DOT de >
		Ivan Brawley < ivan <> brawley DOT id DOT au >,
		CURRENT ML
2008-11-12 09:52:06 +00:00
Nathan Whitehorn
4d3800847a Modify our boot block to pick an output device, without which boot1 will fail
on G4 machines. On the assumption that most people using FreeBSD on Apple
hardware are not using serial consoles, set boot1's output to screen. This
should be revisited. While here, reduce verbosity of boot1.
2008-10-31 00:52:31 +00:00
Rafal Jaworowski
0ed948780c Initial support of loader(8) for ARM machines running U-Boot.
This uses the common U-Boot support lib (sys/boot/uboot, already used on
FreeBSD/powerpc), and assumes the underlying firmware has the modern API for
stand-alone apps enabled in the config (CONFIG_API).

Only netbooting is supported at the moment.

Obtained from:	Marvell, Semihalf
2008-10-14 10:11:14 +00:00
Nathan Whitehorn
5f7ec695e9 Add a simple HFS boot block implementation for booting PowerPC macs. It creates
a small HFS filesystem with a CHRP boot script and an early-stage bootloader
derived from the sparc64 boot block.

Obtained from:  sparc64
2008-10-14 03:32:41 +00:00
Nathan Whitehorn
f184eace75 Don't close OF disk devices on PowerPC. This fixes loader when booting from
disk on my Blue & White G3 system.
2008-10-13 17:14:29 +00:00
Warner Losh
63b90047fc More diff reductions against ixp425/boot2/boot2.c. This time, we
bring in FIXUP_BOOT_DRV functionality as an #ifdef.  This is not
enabled at this time, and the md5 remains constant with this change.
Apart from the 'accept any partitioning scheme on the device' changes,
this was the biggest delta...

# and yes, we'll merge these into one source file if we can do that in a
# way that makes sense.

Obtained from:	sys/boot/arm/ixp425/boot2/boot2.c
2008-10-07 17:44:04 +00:00
Warner Losh
d7798997d7 Diff reduction with boot/arm/at91/boot2/boot2.c: indent this statement
correctly.
2008-10-07 17:27:37 +00:00
Sam Leffler
6497012386 don't hardcode cc
Submitted by:	Andrey Eltsov
2008-10-07 16:39:17 +00:00
John Baldwin
f252d86740 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
2008-10-07 14:05:42 +00:00
John Hay
563db8c39c Add a boot loader for ixp425 based boards like the Gateworks Avila
and ADI Pronghorn Metro with Redboot on them.
2008-10-06 19:38:10 +00:00
Warner Losh
8af5ac823c Bring in the trivial differences between this code and John Hay's new
code.  Added a copyright for the work I did to this file a couple of
years ago.  Add John's copyright too, since I'm sure I'll be pulling
more into this code.  This also implements a new -n option to not
allow breaking into the boot sequence which was original in the patch
John posted (not in the original i386 code I based this boot2.c on,
only the name is the same).  I haven't checked to see if he did that,
or if it was one of Sam's improvements.

Submitted by:	jhay@
2008-10-05 23:59:52 +00:00
Warner Losh
6f07042ef4 Remove XMODEM_DL support. It never was complete and only serves to
increase the diffs with other arm boot2 loaders.
2008-10-05 23:39:28 +00:00
Warner Losh
06afbca3c8 Indent with 8-space tabs. This reduces the diffs to the newer ixp425
boot2 and may make it easier to merge these files in the future...
2008-10-05 23:37:03 +00:00
Marius Strobl
5e9ebf8b21 Disable ATAPI DMA as it's once again broken in that it causes data
corruption with the on-board AcerLabs M5229 controllers. While at
it, remove the pointless "nothing to autoload yet." message.

MFC after:	3 days
2008-10-05 14:00:44 +00:00
Rafal Jaworowski
0258b0bc1b Minor style(9) fixes for U-Boot API glue. 2008-10-04 13:19:15 +00:00
Rafal Jaworowski
4c0a9db94a U-Boot API glue improvements:
- extend ub_dev_read() and ub_dev_recv() so that the actual len and
  all error codes can be passed and processed properly; unify behaviour of
  these routines

- introduce syscall general error code (API_ESYSC)
2008-10-04 13:10:38 +00:00
Stanislav Sedov
9e0e5b0581 - Add ae(4) to loader.conf.
Approved by:	kib (mentor)
MFC after:	1 week
2008-10-04 11:49:53 +00:00
Maxim Sobolev
d221204d90 Backout rev 183181. It appears that I should have been using boot-device
of "cd:,\\:tbxi" with properly configured boot.tbxi, instead of booting
\boot\loader directly. Rev 183168 could probably stay, since it can be
viewed as an anti-foot-shooting measure and has no impact on normal
operation. I can revert it as well, if anybody objects.
2008-09-19 19:49:58 +00:00
Maxim Sobolev
d873f46379 On PowerPC send output to both "/chosen/stdout" and "screen" nodes, unless
they point to the very same device. This should make loader usable on
some (all?) PowerMacs, where "/chosen/stdout" is disconneted from the
"screen" by the OF init process by default, except when user actually
has requested interaction with OF by holding ALT-CMD-O-F. Along with
rev 183168 this should provide a way to build bootable FreeBSD/ppc
installation or live CD that works OOB. Also, it should bring PowerMac
experience closer to that on other arches.

MFC after:	1 week
		(assiming re@ blessing)
2008-09-19 11:00:14 +00:00
David E. O'Brien
bbb1474986 No FORTH for MIPS. 2008-09-18 15:25:35 +00:00
Marius Strobl
4028a36726 Revert r177108 and restore r60506 for sparc64 as long as libstand
isn't fixed to only open the network device once and not do a open
and close dance on every file access; the firmwares of newer sparc64
machines perform an auto-negotiation with every open which in turn
causes netbooting to take horribly long if we open and close the
device over and over again.
2008-09-10 20:53:22 +00:00
Marius Strobl
d8f4dd34d6 Work around Cheetah+ erratum 34 (USIII+ erratum #10) by relocating
the locked entry in it16 slot 0, which typically is occupied by the
PROM, and manually entering locked entries in slots != 0.

Thanks to Hubert Feyrer for donating the Blade 2000 this change was
developed on.
2008-09-10 20:07:08 +00:00
John Baldwin
26e4688329 Resurrect the sbni(4) driver. Someone finally tested the MPSAFE patches and
the driver worked ok with them.

Tested by:	friends of yar
2008-09-10 18:36:58 +00:00
Marius Strobl
2611aba180 USIII and beyond CPUs have stricter requirements when it comes
to synchronization needed after stores to internal ASIs in order
to make side-effects visible. This mainly requires the MEMBAR #Sync
after such stores to be replaced with a FLUSH. We use KERNBASE as
the address to FLUSH as it is guaranteed to not trap. Actually,
the USII synchronization rules also already require a FLUSH in
pretty much all of the cases changed.
We're also hitting an additional USIII synchronization rule which
requires stores to AA_IMMU_SFSR to be immediately followed by a DONE,
FLUSH or RETRY. Doing so triggers a RED state exception though so
leave the MEMBAR #Sync. Linux apparently also has gotten away with
doing the same for quite some time now, apart from the fact that
it's not clear to me why we need to clear the valid bit from the
SFSR in the first place.

Reviewed by:	nwhitehorn
2008-09-08 20:38:48 +00:00
Marius Strobl
5aa6f9f392 Ensure interrupts are off while in {d,i}tlb_va_to_pa_sun4u().
I think this is necessary in order to make sure the workarounds
in {d,i}tlb_get_data_sun4u() work correctly.
2008-09-04 19:41:54 +00:00
Rafal Jaworowski
cf725aeb0b Improve loader support for U-Boot.
- add new diag commands: devinfo, sysinfo for U-Boot-style details about the system
  configuration
- better memory info summary
- style corrections

Obtained from:	Semihalf
2008-09-03 17:48:41 +00:00
Rafal Jaworowski
387a29b78d Show info about net devices in loader's 'lsdev' command. While there fix style. 2008-09-03 17:41:44 +00:00
Rafal Jaworowski
b2b88c5cb4 Use current SP instead of global data ptr for the U-Boot API signature search hint.
Global data (pointed by R2 on PowerPC) in principle is not guaranteed to be in
proximity of U-Boot heap (where the API signature is placed) accross different
architectures and platforms. Instead, use U-Boot stack pointer as a hint for
the search instead of the global data; this method tends to be more uniform
accross different platforms.

Obtained from:	Semihalf
2008-09-03 16:38:27 +00:00
Rafal Jaworowski
51e8f5a470 Make metadata.c shared across all platforms using U-Boot.
This will [soon] be needed for ARM.
2008-09-03 15:52:05 +00:00
Rafal Jaworowski
aa8fb78b88 Move U-Boot compatibility library to WARNS=2 level. 2008-09-03 15:39:50 +00:00
Marius Strobl
20e6aaf533 - Read ASI_{D,I}TLB_DATA_ACCESS_REG twice in order to work around
errata of USIII and beyond (USIII erratum #19, USIII+ erratum #1,
  USIIIi erratum #1).
- Use the cheetah PA mask in {d,i}tlb_va_to_pa_sun4u() for USIII
  and beyond. This is done so that these functions will still mask
  the debug bits of spitfire-class CPUs once we increase TD_PA_BITS
  to match the number of bits used for the PA by cheetah-class CPUs.
- Change {d,i}tlb_enter_sun4u() to also set TLB_CTX_KERNEL as the
  context of the mappings entered. This is more or less cosmetic as
  TLB_CTX_KERNEL is 0.
- Now that we have to distinguish between different sun4u CPUs in
  the loader anyway, no longer do trial and error when reading the
  portid property.
2008-08-30 16:03:22 +00:00
Matteo Riondato
7b87c1e36e Add geom_journal
PR:	conf/126829
MFC after:	2 days
2008-08-26 13:27:48 +00:00
Marius Strobl
898112a7dc cosmetic changes and style fixes 2008-08-22 20:28:19 +00:00
Weongyo Jeong
2d773df86d Add an entry for the upgt(4) module. 2008-08-11 04:54:43 +00:00
John Baldwin
c22616ec0b - Initialize the vm86 structure to a known-good state. Specifically, always
set the %eflags used during a BIOS call via BTX to 0x202.  Previously
  the flags field was uninitialized garbage, and thus it was "random" if
  interrupts were enabled or not during BIOS calls.
- Use constants from <machine/psl.h> for fields in %eflags.

MFC after:	3 days
2008-08-08 19:41:20 +00:00
John Baldwin
beb5dae355 Fix the hangs reported with the real mode BTX:
- I had errantly assumed that all user requests should run with interrupts
  enabled.  User requests for software interrupts, however, need to disable
  interrupts (and tracing) just like hardware interrupts.
- Disable alignment checking when emulating a hardware interrupt as well
  (based on the description of the real mode operation of the 'INT'
  instruction in the IA-32 manuals).
- Use constants for fields in %eflags.

Tested by:	bz
MFC after:	3 days
2008-08-08 19:39:11 +00:00
Marius Strobl
0b1bfc4986 - Reimplement {d,i}tlb_enter() and {d,i}tlb_va_to_pa() in C. There's
no particular reason for them to be implemented in assembler and
  having them in C allows easier extension as well as using more C
  macros and {d,i}tlb_slot_max rather than hard-coding magic (and
  actually spitfire-only) values.
- Fix the compilation of pmap_print_tte().
- Change pmap_print_tlb() to use ldxa() rather than re-rolling it
  inline as well as TLB_DAR_SLOT and {d,i}tlb_slot_max rather than
  hardcoding magic (and actually spitfire-only) values.
- While at it, suffix the above mentioned functions with "_sun4u" to
  underline they're architecture-specific.
- Use __FBSDID and macros instead of magic values in locore.S.
- Remove unused includes and smp_stack in locore.S.
2008-08-07 22:46:25 +00:00
Rui Paulo
750cd2f486 Add coretemp(4) and k8temp(4).
MFC after:	1 day
2008-08-04 16:13:42 +00:00
Colin Percival
ff1782127a 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
2008-08-04 07:01:42 +00:00
Colin Percival
5fe69bb518 Setting a variable to the same value twice doesn't actually make it
more likely to have the right value.  Remove superfluous assignments.

Found by:	LLVM/Clang Static Checker
2008-08-04 06:39:52 +00:00
Warner Losh
b3f1e9378b Only descend into the boot directory for the architecture if it
actually exists and is a directory or symlink to a directory.
2008-07-23 07:23:33 +00:00
David Malone
744eaff7e6 Add an accept filter for TCP based DNS requests. It waits until the
whole first request is present before returning from accept.
2008-07-18 14:44:51 +00:00
John Baldwin
e9a31041c0 Remove the sbni(4) driver. No one responded to calls to test it on
current@ and stable@.
2008-07-04 21:06:57 +00:00
John Baldwin
2c6298572e Remove the oltr(4) driver. No one responded to calls for testing on
current@ and stable@ for the locking patches.  The driver can always be
revived if someone tests it.

This driver also sleeps in its if_init routine, so it likely doesn't really
work at all anyway in modern releases.
2008-07-04 18:58:53 +00:00
Yoshihiro Takahashi
c190805b5d Remove Japanese document. 2008-07-04 12:19:56 +00:00
Yoshihiro Takahashi
bb0e0b0f50 Fix off-by-one error.
MFC after:	1 week
2008-07-01 11:18:51 +00:00
Ruslan Ermilov
cae17430bf Fix a fallout from SSP commit, and make this compile again.
Bonus: including kern.mk just to pick kernel warning flags
was an extremely bad idea anyway, because it also picked
up CFLAGS (it probably wasn't the case at the time of CVS
rev. 1.1, I haven't checked).  Remove duplicate CWARNFLAGS
from CFLAGS.
2008-06-26 07:56:16 +00:00
Ruslan Ermilov
042df2e2da Enable GCC stack protection (aka Propolice) for userland:
- It is opt-out for now so as to give it maximum testing, but it may be
  turned opt-in for stable branches depending on the consensus.  You
  can turn it off with WITHOUT_SSP.
- WITHOUT_SSP was previously used to disable the build of GNU libssp.
  It is harmless to steal the knob as SSP symbols have been provided
  by libc for a long time, GNU libssp should not have been much used.
- SSP is disabled in a few corners such as system bootstrap programs
  (sys/boot), process bootstrap code (rtld, csu) and SSP symbols themselves.
- It should be safe to use -fstack-protector-all to build world, however
  libc will be automatically downgraded to -fstack-protector because it
  breaks rtld otherwise.
- This option is unavailable on ia64.

Enable GCC stack protection (aka Propolice) for kernel:
- It is opt-out for now so as to give it maximum testing.
- Do not compile your kernel with -fstack-protector-all, it won't work.

Submitted by:	Jeremie Le Hen <jeremie@le-hen.org>
2008-06-25 21:33:28 +00:00
Oliver Fromme
25eed6867e 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)
2008-06-16 17:04:04 +00:00
Konstantin Belousov
7e44e88a84 Fix the incorrect calculation of a block address within a single indirect
block.

PR:	108215
Submitted by:	Yuichiro Goto, y7goto gmail com
MFC after:	2 weeks
2008-06-07 05:49:24 +00:00
John Baldwin
894e70e80d 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
2008-06-07 03:07:32 +00:00
Pyun YongHyeon
c5e73d2ef1 Add an entry for the jme(4) module. 2008-05-27 02:13:25 +00:00
Pyun YongHyeon
6560c3b51b Add an entry for the age(4) module. 2008-05-19 02:13:50 +00:00
John Baldwin
9f88822361 Revert the previous change and let PROBE_KEYBOARD function identical to -P
in boot2/gptboot.
2008-04-09 17:59:17 +00:00
Weongyo Jeong
590ed12305 Add a couple of missing wireless NIC driver modules.
Approved by:	thompsa (mentor)
2008-04-08 01:47:33 +00:00
Christian Brueffer
a6b3965743 Add a couple of missing NIC driver modules.
Approved by:	rwatson (mentor)
MFC after:	3 days
2008-03-28 18:13:09 +00:00
Christian Brueffer
662cac9f23 Fix some "in in" typos in comments.
PR:		121490
Submitted by:	Anatoly Borodin <anatoly.borodin@gmail.com>
Approved by:	rwatson (mentor), jkoshy
MFC after:	3 days
2008-03-26 07:32:08 +00:00
David E. O'Brien
149c7c86d2 style(9) & style.Makefile(9)
Reviewed by:	raj
2008-03-13 17:54:21 +00:00
Rafal Jaworowski
7cc9e5030e Improve handling U-Boot's "eth%daddr" while PowerPC metadata preparation.
We're now more robust against cases of non-sorted and/or non-continuous
numbering of those entries.

Reviewed by:	imp, marcel
Approved by:	cognet (mentor)
2008-03-12 16:12:48 +00:00
Rafal Jaworowski
7572ed5a08 Eliminate artificial increasing of 'netdev_opens' counter in loader's net_open().
This was introduced as a workaround long time ago for some Alpha firmware
(which is now gone), and actually prevented net_close() to ever be
called.

Certain firmwares (U-Boot) need local shutdown operations to be performed on a
network controller upon transaction end: such platform-specific hooks are
supposed to be called via netif_close() (from within net_close()).

This change effectively reverts the following CVS commit:

    sys/boot/common/dev_net.c

    revision 1.7
    date: 2000/05/13 15:40:46;  author: dfr;  state: Exp;  lines: +2 -1
    Only probe network settings on the first open of the network device.
    The alpha firmware takes a seriously long time to open the network device
    the first time.

Also suppress excessive output while netbooting via loader, unless debugging.

While there, make sys/boot/uboot more style(9) compliant.

Reviewed by:	imp
Approved by:	cognet (mentor)
2008-03-12 16:01:34 +00:00
John Baldwin
4937cb2d30 Change the BTX kernel to drop all the way out to real mode to invoke BIOS
routines (V86 requests from the client and hardware interrupt handlers):
- Install trampoline real mode interrupt handlers at IDT vectors 0x20-0x2f
  to handle hardware interrupts by invoking the appropriate vector (0x8-0xf
  or 0x70-0x78).  This allows the 8259As to use vectors 0x20-0x2f in real
  mode as well as protected mode will ensuring that the master 8259A
  doesn't share IDT space with CPU exceptions in protected mode.
- Since we don't need to reserve space for page tables and a page directory
  anymore since dropping paging support, move the TSS and protected mode
  IDT up by 16k.  Grow the ring 1 link stack by 16k as a result.
- Repurpose the ring 1 link stack to be used as a real mode stack when
  invoking real mode routines either via a V86 request or a hardware
  interrupts.  This simplifies a few things as we avoid disturbing the
  original user stack.
- Add some more block comments to explain how the code interacts with the
  V86 structure as this wasn't immediately obvious from the prior comments
  (e.g. that we explicitly copy the seg regs for real mode out of the V86
  struct onto the stack to be popped off when going into real mode, etc.).
  Also, document some of the stack frames we create going to real mode and
  back.
- Remove all of the virtual 86 related code including having to simulate
  various instructions and BIOS calls on a trap from virtual 86 mode.
- Explicitly panic if a user client attempts to perform a V86 CALL
  request that isn't a far call.
- Bump version to 1.2.

Assuming this works ok this should fix some of the long standing issues
with USB booting as well as etherboot.

MFC after:	2 weeks
Submitted by:	kib (some parts from his original real mode patch)
2008-03-10 21:43:31 +00:00
John Baldwin
6b36e87e65 In the PROBE_KEYBOARD case, always enable multiple consoles and set the
serial console as the primary console if the keyboard probe fails.

MFC after:	1 week
2008-03-06 21:43:56 +00:00
Yoshihiro Takahashi
b02402d39a MFi386: revision 1.43
Do not attempt to make an NFS rpc call if using tftp
2008-02-29 05:06:06 +00:00
Yoshihiro Takahashi
8a35feb1e2 MFi386: revision 1.55.
Tweak the verbose disk printing a bit.
2008-02-29 04:56:51 +00:00
John Baldwin
3d26c0693b 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
2008-02-28 17:49:23 +00:00
Yoshihiro Takahashi
fc4dac79e6 MFi386:
Retire the support for using paging in BTX.  It hasn't been used since
  before 4.0.
2008-02-28 17:33:06 +00:00
John Baldwin
5479fa1ad4 Rev 1.72 fixed a bug where if /boot.config changed the console its contents
weren't displayed on the new console.  However, the config string has been
altered as part of being parsed so we only display the first option.  Fix
this by saving a copy of /boot.config before parsing it and displaying the
saved copy after parsing.

MFC after:	1 week
PR:		i386/103972
Submitted by:	Alexandre Belloni  alexandre.belloni of netasq.com
2008-02-28 17:08:05 +00:00
John Baldwin
f666e89bfb Retire the support for using paging in BTX. It hasn't been used since
before 4.0.

Submitted by:	kib
2008-02-27 23:35:39 +00:00
Marcel Moolenaar
859baed9a9 o Build and install the U-Boot loader as ubldr.
o  Don't build/install the manual pages or configuration
   files that are already installed by the OFW loader.
o  Hook the U-Boot loader to the build.
2008-02-23 19:45:20 +00:00
Marcel Moolenaar
8b4c4c1c72 style(9) commit. 2008-02-23 19:43:29 +00:00
Marcel Moolenaar
3802c8b6da Setup the new bootinfo structure.
While here, make local function static and update copyright.
2008-02-23 19:08:25 +00:00
Marcel Moolenaar
0f5615e325 o Keep running on U-Boot's stack.
o  Disable interrupts while not running U-Boot code. We clobber
   registers that the U-Boot interrupt handlers assume to be
   fixed as per the U-Boot register usage. At this time this only
   applies to r14. U-Boot uses r2 now for what they used r29 for.
   After we restore r14 in preparation of doing the syscall, we
   re-enable interrupts. When we return from the syscall, we
   disable interrupts and restore the callee-saved r14.
2008-02-23 18:42:53 +00:00
Marcel Moolenaar
f673ad04f5 The NFS file system support is conditional upon LOADER_NFS_SUPPORT,
not LOADER_NET_SUPPORT.
2008-02-23 18:36:13 +00:00
Marcel Moolenaar
e641a443f4 Add __elfN(relocation_offset). It holds the offset between the virtual
(link) address and the physical (load) address. Ideally, the mapping
between link and load addresses should be abstracted by the copyin(),
copyout() and readin() functions, so that we don't have to add kluges
in __elfN(loadimage)(). Then, we could also have paged virtual memory
for the kernel. This can be important under EFI, where you need to
allocate physical memory form the firmware if you want to work in all
scenarios.
2008-02-23 18:33:50 +00:00
Marcel Moolenaar
b8c02f17ea o Include glue.h
o  Support multiple memory regions.
2008-02-23 17:58:12 +00:00
Marcel Moolenaar
9dbb1b6e7d o Build libuboot with -msoft-float like everything else.
o  Move the API prototypes to a separate header (glue.h)
o  Allow the platform to hint libuboot about where to look
   for the API signature. The uboot_address variable is
   expected to be defined by the platform.
2008-02-23 17:56:17 +00:00
Marcel Moolenaar
719ea9c174 Add the appropriate license information. This file is double
licensed under GPL and BSD.

Thanks to: raj@
2008-02-23 17:52:30 +00:00
Marcel Moolenaar
9a1b62b630 We build ficl and libofw with -msoft-float. Build the loader
with -msoft-float too.
2008-02-23 17:48:23 +00:00
Marcel Moolenaar
a515bae433 Move the $FreeBSD$ tag in a comment as __FBSDID doesn't work. 2008-02-17 20:38:22 +00:00
Marcel Moolenaar
65beb4ed7a Hook the U-Boot library up to the build. 2008-02-17 20:34:35 +00:00
Marcel Moolenaar
da049ec7a5 MFp4 (e500):
Add support for U-Boot. This uses the U-Boot API as developed by
Rafal and which is (will be) part of U-Boot 1.3.2 and later.

Credits to: raj@
2008-02-16 22:40:55 +00:00
Marcel Moolenaar
63094c199a MFp4 (e500):
Add support for U-Boot. This uses the U-Boot API as developed by
Rafal and which is (will be) part of U-Boot 1.3.2 and later.

Credits to: raj@
2008-02-16 22:13:11 +00:00
Rafal Jaworowski
77c843cc10 Clean up PowerPC loader(8) build config.
Turn off TFTP support by default: when both TFTP and NFS are enabled in the
loader, strange interactions occur in the pure netbooting scenario (i.e.
loader is TFTP-ed, kernel+world mounted over NFS), leading to very slow access
to the NFS-exported files.

Reviewed by:	grehan
Approved by:	cognet (mentor)
2008-02-11 12:30:32 +00:00
Peter Grehan
e45efebc97 Make the openfirmware getchar entry point non-blocking. This catches up
with jhb's 2005/05/27 loader multiple-console change.

Tested by: marius/sparc64, grehan/ofwppc
2008-02-06 22:04:28 +00:00
Giorgos Keramidas
82d16f31df Bump manpage date for rev 1.27
MFC after:	3 days
2008-01-16 07:00:55 +00:00
Giorgos Keramidas
b8b4c607d8 Document that loader(8) stops reading `loader.conf' when it
encounters a syntax error, and add a tip about adding first
the `vital' options and then experimental ones.

PR:		docs/119658
Submitted by:	Julian Stacey, jhs at berklix.org
2008-01-16 06:59:22 +00:00
Marcel Moolenaar
ed04c6bea1 "FreeBSD/Open Firmware/PowerPC ..." is confusing and non-standard.
Use "FreeBSD/powerpc Open Firmware ..." instead.
2007-12-26 19:15:58 +00:00
Bernd Walter
36782b8ef3 - remove code from oroginal file, which is not required on BWCT boards
- Be more chatty on startup, since we have enough code space on
  AT91RM9200
- init DS1672 charging
- init USART GPIO
2007-12-23 14:57:35 +00:00
Bernd Walter
fc29b8c535 BWCT boards uses two different SPI flash chips
check for both status codes
2007-12-23 14:46:30 +00:00
Doug Ambrisko
c609b15425 Allow negative values to be specified in the loader. 2007-12-19 17:06:32 +00:00
Marcel Moolenaar
6d86273c0a Remove file after being repocopied to ../ofw, where it lives on.
Repocopy by: simon@
2007-12-17 22:50:39 +00:00
Marcel Moolenaar
22f4c5e3d9 Build the OFW loader from its new location after the sources
were repocopied from ./loader to ./ofw.
2007-12-17 22:19:44 +00:00
John Baldwin
8ec770db87 Add a note to indicate that these files do borrow in part from mbr.s and
boot1.S

Requested by:	rnordier
2007-11-26 21:29:59 +00:00
Yoshihiro Takahashi
780e069c49 MFi386: revision 1.18
Add a trailing \0 to the read error string so that read errors don't print
  out two error messages.
2007-11-18 03:14:06 +00:00
John Baldwin
59e36e4730 Add a trailing \0 to the read error string so that read errors don't print
out two error messages.

MFC after:	3 days
2007-11-17 17:32:40 +00:00
Bjoern A. Zeeb
fc89eb3a4c 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
2007-11-12 23:53:43 +00:00
Ruslan Ermilov
a10b45505a Document the per-arch default value of kern.maxbcache. 2007-11-08 11:59:38 +00:00
John Baldwin
8518d50a63 - 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.
2007-10-28 21:23:49 +00:00
John Baldwin
fd6d060f0d Use the smaller cgbase() macro in ufsread.c if UFS_SMALL_CGBASE is
defined.  This lets each boot program choose which version of cgbase() it
wants to use rather than forcing ufsread.c to have that knowledge.

MFC after:	1 week
Discussed with:	imp
2007-10-26 21:02:31 +00:00
John Baldwin
150b476d94 Add . to the include path so that we follow the 'machine' symlink we create
during depend on amd64.

Reported by:	rwatson
2007-10-26 15:56:22 +00:00
Warner Losh
8d7b90cdd7 The arm boot code uses this function as well. Redefining cgbase()
saves about 500 bytes in the boot code.  While the AT91RM9200 has 12k
of space for the boot loader, which is more than i386's 8k, the code
generated by gcc is a bit bigger.

I've had this in p4 for about two years now.
2007-10-26 15:00:34 +00:00
Olivier Houchard
26989574c9 Fix signedness to make gcc happy. 2007-10-25 22:50:25 +00:00
John Baldwin
627457cd4a 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
2007-10-25 16:53:35 +00:00
Yoshihiro Takahashi
34b1e3506c MFi386: part of 1.52
Split the pc98_partition specific routine in bd_opendisk()
into bd_open_pc98().
2007-10-25 14:31:52 +00:00
Yoshihiro Takahashi
91dfd26985 MFi386: part of revision 1.51
Rework the read/write support in the bios disk driver some to cut down
  on duplicated code.
  - 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().
2007-10-25 12:57:46 +00:00
Warner Losh
3e6468f751 Load the bytes into the EMAC's MAC address register in the proper
order.  The kernel used to shuffle them around to get things right,
but that was recently fixed.  This makes our boot loader match the
behavior of most other boot loaders for the atmel parts.  This bug was
inherited from the Kwikbyte loader that we started from.

This bug was discovered by Bj.ANvrn KNvnig back in June, but fell on the
floor.  He provided patches to the kernel, include backwards
compatibility options that were similar to Olivier's if_ate.c commit.
2007-10-25 07:05:38 +00:00
John Baldwin
f352a0d45f 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)
2007-10-24 21:33:00 +00:00
John Baldwin
2143962647 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
2007-10-24 12:49:55 +00:00
Yoshihiro Takahashi
1c44b03ee9 MFi386: revision 1.50
Reindent the read/write code of bd_realstrategy() so it is more readable.
2007-10-24 12:03:48 +00:00
Yoshihiro Takahashi
18a60bb546 MFi386: revision 1.41
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.
2007-10-24 11:54:04 +00:00
John Baldwin
08981e2f6d Reindent the read/write code of bd_realstrategy() so it is more readable.
MFC after:	1 week
2007-10-24 04:13:35 +00:00
John Baldwin
5c5b5d4607 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
2007-10-24 04:03:25 +00:00
Yoshihiro Takahashi
51626c2003 Optimize for size on pc98. It enables to boot a kernel again.
I don't know what's wrong (loader, boot2 or others), but this change is
effective.

Tested by:	NAKAJI Hiroyuki
MFC after:	3 days
2007-10-15 14:20:24 +00:00
Paul Saab
671a6b8e9a Do not attempt to make an NFS rpc call if using tftp
PR:		kern/91720
Submitted by:	Ruben Kerkhof
2007-10-12 17:09:43 +00:00
David E. O'Brien
fb6e00667c Also boot *.debug if everything else fails.
Approved by:	re(gnn)
2007-10-04 18:29:52 +00:00
Ruslan Ermilov
2c822a5b73 Mention that autoboot_delay also accepts the "NO" value.
Approved by:	re (kensmith)
2007-09-26 08:38:25 +00:00
Warner Losh
eb2e7f82ff Don't pass RB_BOOTINFO to the kernel. There's no bootinfo actually
passed into the kernel, and the kernel will soon grow that ability on
arm.

Approved by: re@ (blanket)
2007-08-17 18:22:31 +00:00
Warner Losh
4ced8fb56a Use the .S version for now. I have a version optimized for size p4,
but I'm unsure of its provenance, so rather than add it here, revert
the migration to it.

Approved by: re@ (blanket)
2007-08-09 05:16:55 +00:00
Warner Losh
229af622b8 MFp4:
Add support for the CENTIPAD board (http://www.harerod.de/centipad/index.html)
	(which is a very cool, very small ARM board)
Add support for KB9202B (it has different memory)
Make BOOT_FLAVOR settable
Minor cleanup nits

Approved by: re@
2007-07-13 14:27:05 +00:00
Rong-En Fan
534046e301 - Remove UMAP filesystem. It was disconnected from build three years ago,
and it is seriously broken.

Discussed on:   freebsd-arch@
Approved by:	re (mux)
2007-06-25 05:06:57 +00:00
Marius Strobl
aa785996fd - Make better use of the global chosen, memory and mmu handles instead
of obtaining them over and over again and pretending we could do
  anything useful without them (for chosen this includes adding a
  declaration and initializing it in OF_init()).
- In OF_init() if obtaining the memory or mmu handle fails just call
  OF_exit() instead of panic() as the loader hasn't initialized the
  console at these early stages yet and trying to print out something
  causes a hang. With OF_exit() one at least has a change to get back
  to the OFW boot monitor and debug the problem.
- Fix OF_call_method() on 64-bit machines (this is a merge of
  sys/dev/ofw/openfirm.c rev 1.6).
- Replace OF_alloc_phys(), OF_claim_virt(), OF_map_phys() and
  OF_release_phys() in the MI part of the loader with wrappers around
  OF_call_method() in the sparc64. Beside the fact that they duplicate
  OF_call_method() the formers should never have been in the MI part
  of the loader as contrary to the OFW spec they use two-cell physical
  addresses.
- Remove unused functions which are also MD dupes of OF_call_method().
- In sys/boot/sparc64/loader/main.c add __func__ to panic strings as
  different functions use otherwise identical panic strings and make
  some of the panic strings a tad more user-friendly instead of just
  mentioning the name of the function that returned an unexpected
  result.
2007-06-17 00:17:15 +00:00
Marius Strobl
555f163cd2 - Remove dupe and unused declarations and prototypes.
- Add missing prototypes.
- Define global variables not used outside of this module as static.
- Replace some outdated hard-coded functions names in panic strings
  with __func__.
- Fix some style(9) bugs.
2007-06-16 21:46:15 +00:00
Marius Strobl
7d62dd366b Sync the styles of sys/boot/ofw/libofw/openfirm.c and
sys/dev/ofw/openfirm.c with themselves, with each-other
and with style(9).
2007-06-16 21:38:04 +00:00
Hidetoshi Shimokawa
97995404be MFp4: add FireWire/dcons support in loader for i386/amd64.
It is disabled by default. You need to put
LOADER_FIREWIRE_SUPPORT=yes in /etc/make.conf
and rebuild loader to enable it.
(cd /sys/boot/i386 && make clean && make && make install)

You can find a short introduction of dcons at
http://wiki.freebsd.org/DebugWithDcons
2007-05-29 14:35:57 +00:00
Marcel Moolenaar
9beb1d0779 Have the processor defer all faults and exceptions for control
speculative loads. This at least makes control speculative loads
work. In the future we should analyze which faults/exceptions
we want to handle rather than defer to avoid having to call the
recovery code when it's not strictly necessary.
2007-05-27 19:02:47 +00:00
Jung-uk Kim
bf5a3266f7 Use lower cases for UUID string to conform RFC4122 and ISO/IEC-9834-8:2005. 2007-05-21 18:48:18 +00:00
Alexander Kabaev
12c95a2554 Tweak inlining parameters a little. Add warning to tell us if function
we declared as inline can not be inlined.
2007-05-19 05:07:47 +00:00