Commit Graph

706 Commits

Author SHA1 Message Date
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
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 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
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
Yoshihiro Takahashi
bb0e0b0f50 Fix off-by-one error.
MFC after:	1 week
2008-07-01 11:18:51 +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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Thomas Quinot
9068c00114 Fix setting of serial port speed. A junk value was passed in AX when
bioscom is called to set up serial port parameters because COMSPEED
was treated as an address instead of an immediate value, causing
serial port parameters to never be set.

PR:		i386/110828
Reviewed by:	jhb
MFC after:	2 weeks
2007-03-26 21:56:13 +00:00
Jung-uk Kim
2be4e4713a Catch up with ACPI-CA 20070320 import. 2007-03-22 18:16:43 +00:00
Remko Lodder
54084306cd Fix the cdboot twiddle display.
I created and tested this with a custom FreeSBIE cd-image.

PR:		i386/96452
Submitted by:	Yuichiro Goto <y7goto at gmail dot com>
MFC after:	3 days
Approved by:	imp (mentor)
2007-02-23 21:07:44 +00:00
John Baldwin
44496fb5f2 Ignore any breakpoint instructions (int 3) we encounter in vm86 mode
rather than treating them as a fatal exception and halting.  At least one
storage BIOS (some newer mpt(4) parts) have a breakpoint instruction in
their disk read routine.

MFC after:	3 days
2006-12-06 17:45:35 +00:00
Ruslan Ermilov
8d594a3fb5 Remove an unused variable. 2006-11-16 13:32:30 +00:00
Ruslan Ermilov
593bbd2195 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
2006-11-02 17:28:38 +00:00
Marcel Moolenaar
932d8c46a2 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.
2006-11-02 01:23:18 +00:00
Marcel Moolenaar
5cae408f81 Don't unconditionally compile-in the bcache code. It's only used on
i386/amd64 and pc98. Remove useless calls to bcache_init() from the
ia64 and sparc64 loaders, as well as from the OFW common code.
2006-11-02 00:26:45 +00:00
Ruslan Ermilov
da6d4298b7 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)
2006-10-29 14:50:58 +00:00
Ruslan Ermilov
50159fa216 Adopt comments borrowed from aout_freebsd.c. 2006-10-26 20:04:22 +00:00
Ruslan Ermilov
5a20bc0d54 Restore support for -c and -d that were treacherously murdered in
rev. 1.58.  (This only costs us four bytes.)

Prodded by:	bde
MFC after:	3 days
2006-10-26 19:41:02 +00:00
Ruslan Ermilov
5098c00abe Back out rev. 1.71 as it breaks directly loading (i386) kernels.
OK'ed by:	jhb
PR:		i386/96430, i386/104709
MFC after:	3 days
2006-10-26 19:15:54 +00:00
Pav Lucistnik
1cd46fae01 - Update URL of Intel documentation
Submitted by:	Rob <spamrefuse@yahoo.com> on freebsd-doc
MFC after:	3 days
2006-10-07 10:39:34 +00:00
John Baldwin
ce34bd6bca - Fix a couple of improper uses of leal in the previous space saving
commits.  For some reason I thought the scale factor was a shift count
  rather than the multiplicand (that is, I thought leal (%eax,%edx,4) was
  going to generate %eax + %edx << 4 rather than %eax + %edx * 4).  What
  I need is to multiply by 16 to convert a real-mode (seg, offset) tuple
  into a flat address.  However, the max multiplicand for scaled/index
  addressing on i386 is 8, so go back to using a shl and an add.
- Convert two more inter-register mov instructions where we don't need to
  preserve the source register to xchg instructions to keep our space
  savings.

Tested by:	Ian FREISLICH if at hetzner.co.za
MFC after:	1 week
2006-10-05 15:30:51 +00:00
Ruslan Ermilov
6dcf625c41 Fix most of the WARNS=2 warnings. 2006-09-29 20:27:41 +00:00
John Baldwin
f3088510e2 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
2006-09-29 20:07:16 +00:00
John Baldwin
d64e328e3c Tweak the code to handle intercepting BIOS calls to int 0x15 to shave
another 16 bytes off of BTX (and thus boot2):
- Compare against the value of %eax that is saved on the stack instead of
  loading it into %eax (which requires saving the current %eax on the
  stack).
- Use %ch to examine the keyboard flag state in the BIOS to see if
  Ctrl-Alt-Del is pressed instead of %al so we don't have to save %eax on
  the stack anymore.

MFC after:	1 week
2006-09-28 19:42:10 +00:00
John Baldwin
4b9657e974 Optimize the int 15/87 handler for space to shave another 16 bytes off of
BTX (and thus boot2):
- Don't bother saving %eax, %ebx, or %ecx as it is not necessary.
- Use a more compact sequence to load the base value out of a GDT entry
  by loading the contiguous low 24 bits into the upper 24 bits of %eax,
  loading the high 8 bits into %al, and using a ror to rotate the bits
  (2 mov's and a ror) rather than loading the pieces in smaller chunks
  (3 mov's and a shl).
- Use movzwl + leal instead of movl + movw + shll + addl.
- Use 'xchgl %eax,%foo' rather than 'movl %eax,%foo' for cases where
  it's ok to trash %eax.  xchgl %eax, foo is a 1-byte opcode whereas the
  mov is a 2-byte opcode.
- Use movzwl rather than xorl + movw.

MFC after:	1 week
2006-09-28 19:38:02 +00:00
John Baldwin
c4f7c44bb3 Add an 'smap' command that dumps out the BIOS SMAP.
MFC after:	1 week
2006-09-28 19:07:13 +00:00
John Baldwin
add92b34d1 A couple of simple tweaks that trim BTX by 6 bytes. Since BTX is
16-byte aligned within boot2 however, this actually trims boot2 by 16
bytes.
2006-09-28 16:30:36 +00:00
Ruslan Ermilov
2d78e8c5f1 Add -march=i386 to fix amd64 build by generating the same code
as i386 would do.
2006-09-28 10:02:04 +00:00
John Baldwin
3ea944faa0 Emulate moving cr0, cr2, cr3, or cr4 into any i386 general register
rather than just emulating mov cr0, eax.  This fixes some Compaq/HP BIOS
with DMA (as the BIOS tried to read cr3 so it could translate addresses
if paging was enabled).

MFC after:	1 week
2006-09-27 19:32:26 +00:00
Ruslan Ermilov
b0e014af29 - Include <sys/reboot.h> to get the RB_* defines.
- Make the PROBE_KEYBOARD option better resemble the -P option in
  boot2, i.e., if keyboard isn't present then boot with both
  RB_SERIAL and RB_MULTIPLE set.

Reviewed by:	jhb
2006-09-05 19:28:03 +00:00
Yaroslav Tykhiy
776fc0e90e Commit the results of the typo hunt by Darren Pilgrim.
This change affects documentation and comments only,
no real code involved.

PR:		misc/101245
Submitted by:	Darren Pilgrim <darren pilgrim bitfreak org>
Tested by:	md5(1)
MFC after:	1 week
2006-08-04 07:56:35 +00:00
Ian Dowse
9c0ce099e6 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
2006-05-31 09:05:49 +00:00
John Baldwin
cde0d87b26 Restore the pre-5.x behavior of only beeping if the user makes a bad
selection and not always beeping on startup.  The two bytes for the extra
'jmp' instruction were obtained by removing recognition of BSD/OS
partitions.

Requested by:	many
Tested by:	subset of many
Head nod:	imp, keramida
MFC after:	2 weeks
2006-05-03 13:43:46 +00:00
John Baldwin
b5fd832d94 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.)
2006-04-25 18:42:22 +00:00
Maxim Sobolev
e101181393 Merge in timeout into A20-enable routine from cdboot/boot1.
MFC after:	1 day
2006-04-11 20:53:49 +00:00
John Baldwin
31062da1b0 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.
2006-04-11 20:11:30 +00:00
John Baldwin
a115c84d58 Minor whitespace tweak. 2006-04-11 20:09:42 +00:00
John Baldwin
3793634041 Tweak comment. 2006-04-11 17:36:08 +00:00
John Baldwin
70e040dfcf Use the proper condition to determine that we matched an filename.
Otherwise, we could match on a filename that had the wrong last character
(such as /boot/loaded instead of /boot/loader).

PR:		kern/95625
Submitted by:	Oliver Fromme <olli@secnetix.de>
MFC after:	1 month
2006-04-11 17:26:54 +00:00
Maxim Sobolev
cd86367a5a When enabling A20 put upper limit on amount of time we wait for the keyboard
controller to get ready (65K x ISA access time, visually around 1 second).
If we have wait more than that amount it's likely that the hardware is a
legacy-free one and simply doesn't have keyboard controller and doesn't
require enabling A20 at all.

This makes cdboot working for MacBook Pro with Boot Camp.

MFC after:	1 day
2006-04-11 04:39:29 +00:00
Ruslan Ermilov
e1fe3dba5c Reimplementation of world/kernel build options. For details, see:
http://lists.freebsd.org/pipermail/freebsd-current/2006-March/061725.html

The src.conf(5) manpage is to follow in a few days.

Brought to you by:	imp, jhb, kris, phk, ru (all bugs are mine)
2006-03-17 18:54:44 +00:00
Jung-uk Kim
07b4d1cc39 Export SMBIOS serial numbers by default. To turn it off, use
'BOOT_HIDE_SERIAL_NUMBERS' knob.

Suggested by:	ceri
2006-03-14 19:02:00 +00:00
Jung-uk Kim
1c9e617c34 Micro-optimize invalid UUID check. 2006-03-10 23:33:27 +00:00
Jung-uk Kim
65796b26b3 - 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.
2006-03-09 22:49:44 +00:00
Maxim Sobolev
e4f5866fd5 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
2005-12-21 02:17:58 +00:00
Maxim Sobolev
f668cd5df7 If LOADER_BZIP2_SUPPORT is defined allocate heap in the 1MB-4MB range to
provide enough room for decompression (up to 2.5MB is necessary). This
should be safe to do since we load i386 kernels after 8MB mark now, so
that 16MB is the minimum amount of RAM necessary to even boot FreeBSD.

This makes bzip2-support  practically useable.
2005-12-19 09:26:42 +00:00
Maxim Sobolev
915dad0e92 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.
2005-12-19 09:00:11 +00:00
Ruslan Ermilov
6e7a7ba194 Consistently use OPT_* macros to test/set boot options. 2005-11-03 07:35:36 +00:00
Scott Long
fe8388fec2 Add back some bits. 2005-10-30 05:41:42 +00:00
Jung-uk Kim
529bc4bf80 Export processor socket information. New environment variables are:
smbios.socket.enabled:		number of enabled sockets
smbios.socket.populated:	number of populated sockets
2005-10-18 20:03:31 +00:00
Maxim Sobolev
a9c76d92d2 Re-implement rev.1.76 with respect to the code size. 2005-10-16 20:22:36 +00:00
Maxim Sobolev
6267ee870d Backout previous commit - for some reason it overflows space constrains on
amd64. Better version will follow.
2005-10-16 19:49:44 +00:00
Maxim Sobolev
50d89fc56a Add new option `q', which makes second stage loader quiet unless autoboot
is disabled or fails.

MFC after:	1 week
2005-10-16 01:55:35 +00:00
Ruslan Ermilov
fddd9c1d2f 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.
2005-09-22 15:14:13 +00:00
Ruslan Ermilov
4750e08f7b Add loader(8) variables for RB_DFLTROOT, RB_MUTE, and RB_PAUSE:
"boot_dfltroot", "boot_mute", and "boot_pause" respectively.
2005-09-22 15:06:58 +00:00
Ruslan Ermilov
5272ce4796 - RBX_MASK wasn't updated when RB_PAUSE was changed from 0x40000
to 0x100000 in rev. 1.67.

- NOPT wasn't updated (decremented) in previous revision.
2005-09-22 11:20:33 +00:00
Ian Dowse
4832a19173 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.
2005-08-18 01:39:43 +00:00
Ian Dowse
a00a259113 Add the ability to specify the boot2 serial console speed in
/boot.config or on the "boot:" prompt line via a "-S<speed>" flag,
e.g. "-h -S19200". This adds about 50 bytes to the size of boot2
and required a few other small changes to limit the size impact.
This changes only affects boot2; there are further loader changes
to follow.
2005-08-18 00:42:45 +00:00
Suleiman Souhlal
1446d11a9b The kernel is usually at /boot/kernel/kernel nowadays.
PR:	i386/81756
Submitted by:	trasz <trasz@buziaczek.pl>
2005-08-06 00:33:42 +00:00
Jung-uk Kim
fd95fd457f 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)
2005-07-27 19:11:10 +00:00
Andrey A. Chernov
63ecaee8d6 Add -mno-sse3 for prescott/nocona 2005-07-15 12:22:14 +00:00
Jung-uk Kim
3e709972e1 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)
2005-07-14 19:52:22 +00:00
David E. O'Brien
659e382f5b Temperarly disable building in the bzip2 support by default so we can fit
on the i386 floppies.  Sigh, I hate floppies.
2005-06-01 15:32:57 +00:00
David E. O'Brien
264d3e6b45 Put bzip2 support on equal footing with gzip support.
Enable bzip2 support by default, set LOADER_NO_BZIP2_SUPPORT to disable it.

Pointy hat to:	sobomax
2005-05-31 21:16:50 +00:00
John Baldwin
8b7c03a7a4 - 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
2005-05-27 19:31:00 +00:00
John Baldwin
9389b62e52 Fix a warning by adding a missing 'const'.
MFC after:	1 week
2005-05-27 19:28:04 +00:00
John Baldwin
5b09b18204 Print out the commands from /boot.config after parsing them so that they
output is sent to the correct console(s).

PR:		kern/66425
Submitted by:	Gavin Atkinson gavin at ury dot york dot ac dot uk
MFC after:	1 week
2005-05-27 19:26:11 +00:00
Philippe Charnier
f942457007 Remove unused variables. Remove prototype for function that does not exist. 2005-05-20 13:14:18 +00:00
Ruslan Ermilov
e2bc0fb2ea Allow BOOT_BOOT0_COMCONSOLE_SPEED to be derived from BOOT_COMCONSOLE_SPEED
at compile time.
2005-04-25 17:41:35 +00:00
Garrett Wollman
98576a6485 Pass the hostname we got from DHCP to the kernel so that machines can
share a read-only NFS root.
2005-04-17 21:38:22 +00:00
Nate Lawson
2626a56934 Extend a local buffer to prevent an overflow of the XSDT address.
Submitted by:	Joerg Sonnenberger
Obtained from:	DragonflyBSD
MFC after:	1 day
2005-04-16 17:38:24 +00:00
Stefan Farfeleder
94bd92c387 Fix 'implicit int' instance. 2005-04-09 14:07:13 +00:00
David E. O'Brien
0ed36875f4 Ensure GCC does not use FP registers in integer code.
I think all we really need is -fno-sse2.
I really don't like cluttering up the compiler invocation,
but this bigger hammer will fix reported problems for now.
2005-03-15 18:43:36 +00:00
Alexander Kabaev
721d5bfe2e 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.
2005-03-12 21:26:53 +00:00
Dag-Erling Smørgrav
d04928f224 Remove type 0x4 (FAT12 <32MB) to make room for type 0x7 (NTFS). 2005-02-08 20:43:04 +00:00
Peter Edwards
5c33db12dc Only update the boot sector when there is a valid drive number provided.
(After squeezing a few more bytes out of boot0)

Discussed With: jhb, julian
PR: 66248
Submitted By: Hans Petter Selasky
MFC After: 1 week
2005-01-09 23:30:35 +00:00