summaryrefslogtreecommitdiffstats
path: root/sys/boot/ofw
Commit message (Collapse)AuthorAgeFilesLines
* MFC r313982, r314068:pfg2017-03-141-1/+1
| | | | | | sys: Replace zero with NULL for pointers. Found with: devel/coccinelle
* MFC r309369,310850,310853:tsoome2017-02-061-3/+3
| | | | | | | | | | libstand: dosfs cstyle cleanup for return keyword. dosfs support in libstand is broken since r298230 PR: 214423 Submitted by: Mikhail Kupchik Reported by: Mikhail Kupchik Approved by: imp (mentor)
* MFC r310225: Reduce boot loader version string duplicationemaste2017-01-171-7/+2
| | | | | Instead of repeating "%s, Revision %s" "(%s %s)" in each loader, just create the full version string in vers.c
* sys/boot: spelling fixes in comments.pfg2016-04-301-1/+1
| | | | No functional change.
* A new implementation of the loader block cacheallanjude2016-04-181-3/+3
| | | | | | | | | | | | | | | | | The block cache implementation in loader has proven to be almost useless, and in worst case even slowing down the disk reads due to insufficient cache size and extra memory copy. Also the current cache implementation does not cache reads from CDs, or work with zfs built on top of multiple disks. Instead of an LRU, this code uses a simple hash (O(1) read from cache), and instead of a single global cache, a separate cache per block device. The cache also implements limited read-ahead to increase performance. To simplify read ahead management, the read ahead will not wrap over bcache end, so in worst case, single block physical read will be performed to fill the last block in bcache. Booting from a virtual CD over IPMI: 0ms latency, before: 27 second, after: 7 seconds 60ms latency, before: over 12 minutes, after: under 5 minutes. Submitted by: Toomas Soome <tsoome@me.com> Reviewed by: delphij (previous version), emaste (previous version) Relnotes: yes Differential Revision: https://reviews.freebsd.org/D4713
* Add more .NOMETA missed in r291320bdrewery2016-03-111-1/+1
| | | | Sponsored by: EMC / Isilon Storage Division
* Allow loader to load 64-bit ELFv2 PowerPC kernels.nwhitehorn2015-12-011-2/+5
|
* Provide a shim layer in loader to condense the Open Firmware device tree tonwhitehorn2015-03-095-9/+36
| | | | | | | an FDT. This is how Linux and OS X boot and can avoid some issues with using Open Firmware at runtime. The code is highly experimental and disabled by default; it can be turned on by setting the loader environment variable "usefdt" to a non-NULL value.
* Give loaders more control over the Forth initialization process. Inmarcel2014-07-271-1/+1
| | | | | | | | | | | | | | | | | | | particular, allow loaders to define the name of the RC script the interpreter needs to use. Use this new-found control to have the PXE loader (when compiled with TFTP support and not NFS support) read from ${bootfile}.4th, where ${bootfile} is the name of the file fetched by the PXE firmware. The normal startup process involves reading the following files: 1. /boot/boot.4th 2. /boot/loader.rc or alternatively /boot/boot.conf When these come from a FreeBSD-defined file system, this is all good. But when we boot over the network, subdirectories and fixed file names are often painful to administrators and there's really no way for them to change the behaviour of the loader. Obtained from: Juniper Networks, Inc.
* Fix panics on attempt to dereference uninitizlized pointer, returned viamav2012-09-181-1/+1
| | | | | | | 'path' argument of ofw_parsedev() if devspec refers raw device with no path. For example, `ls /pci@1f,0/ide@d/disk@0,0:a/` works fine, while `ls /pci@1f,0/ide@d/disk@0,0:a` panicked before this change.
* The workaround added in r151650 for handling firmwares that don't allowmarius2012-06-041-68/+56
| | | | | | | | | | | | a single device to be opened multiple times concurrently unfortunately isn't sufficient with ZFS. This is due to the fact, that ZFS may open different partitions of a single device simultaneously. So the best we can do in this case is to cache the lastly used device path and close and open devices in ofwd_strategy() as needed. PR: 165025 Submitted by: Gavin Mu MFC after: 1 week
* sparc64/zfs boot: take advantage of new libzfsboot capabilitiesavg2012-05-123-9/+16
| | | | | | | Also drop the now unneeded compatibility shims. Tested by: marius MFC after: 1 month
* Add initial support for booting from ZFS on sparc64. At least on Sun Firemarius2012-05-011-3/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | V100, the firmware is known to be broken and not allowing to simultaneously open disk devices, causing attempts to boot from a mirror or RAIDZ to cause a crash. This will be worked around later. The firmwares of newer sun4u models don't seem to exhibit this problem though. Steps for ZFS booting: 1. create VTOC8 label # gpart create -s vtoc8 da0 2. add partitions, f.e.: # gpart add -t freebsd-zfs -s 60g da0 # gpart add -t freebsd-swap da0 resulting in something like: # gpart show => 0 143331930 da0 VTOC8 (68G) 0 125821080 1 freebsd-zfs (60G) 125821080 17510850 2 freebsd-swap (8.4G) 3. create zpool # zpool create bunker da0a or for mirror/RAIDZ (after preparing additional disks as in steps 1. + 2.): # zpool create bunker mirror da0a da1a # zpool create bunker raidz da0a da1a da2a ... 4. set bootfs # zpool set bootfs=bunker bunker 5. install zfsboot # zpool export bunker # gpart bootcode -p /boot/zfsboot da0 6. write zfsloader to the ZFS Boot Block (so far, there's no dedicated tool for this, so dd(1) has to be used for this purpose) When using mirror/RAIDZ, step 4. and the dd(1) invocation should be repeated for the additional disks in order to be able to boot from another disk in case of failure. # sysctl kern.geom.debugflags=0x10 # dd if=/boot/zfsloader of=/dev/da0a bs=512 oseek=1024 conv=notrunc # zpool import bunker 7. install system on ZFS filesystem Don't forget to set 'zfs_load="YES"' and vfs.root.mountfrom="zfs:bunker" in loader.conf as well as 'zfs_enable="YES"'in rc.conf. 8. copy zpool.cache to the ZFS filesystem cp -p /boot/zfs/zpool.cache /bunker/boot/zfs/zpool.cache 9. set mountpoint # zfs set mountpoint=/ bunker 10. Now, given that aliases for all disks in the zpool exists (check with the `devalias` command on the boot monitor prompt) and disk0 corresponds to da0 (likewise for additional disks), the system can be booted from the ZFS with: {1} ok boot disk0 PR: 165025 Submitted by: Gavin Mu
* Replace index() and rindex() calls with strchr() and strrchr().ed2012-01-032-2/+2
| | | | | | | | | | The index() and rindex() functions were marked LEGACY in the 2001 revision of POSIX and were subsequently removed from the 2008 revision. The strchr() and strrchr() functions are part of the C standard. This makes the source code a lot more consistent, as most of these C files also call into other str*() routines. In fact, about a dozen already perform strchr() calls.
* Rename the linker emulation name for powerpc and powerc64. This is needed thatandreast2011-11-191-1/+1
| | | | | we can also use the upstream binutils linker where we have to have a unique name for the FreeBSD emulation.
* Check the OF_getprop() return value before proceeding. Allocate only asandreast2010-11-201-4/+4
| | | | | | | | much space as needed for the mode buffer. Use strcmp, relying on OF giving back NULL terminated strings. Submitted by: marius Approved by: nwhitehorn (mentor)
* Check the real-mode? OF property to find out whether we operate in real orandreast2010-11-173-9/+28
| | | | | | | | virtual mode. In virtual mode we have to do memory mapping. On PowerMacs it is usually false while on pSeries we have found that it is true. The real-mode? property is not available on sparc64. Approved by: nwhitehorn (mentor)
* Move the declaration of the eh struct (used only when debugging is enabled)andreast2010-11-171-1/+1
| | | | | | from ofwn_put into the debug section. Approved by: nwhitehorn (mentor)
* Fix the printf() in init_heap so that it can run before the console is up.nwhitehorn2010-10-291-1/+5
| | | | Pointed out by: marius
* Fix netboot on some Apple machines on which calling dma-free on thenwhitehorn2010-10-291-0/+3
| | | | | network device can hang the machine. This causes the loss of 64 KB of accessible memory on netbooted machines.
* Fix some memory management issues discovered when trying to boot the PPCnwhitehorn2010-10-283-28/+35
| | | | | | | | OF loader on systems where address cells and size cells are both 2 (the Mambo simulator) and fix an error where cons_probe() was called before init_heap() but used malloc() to set environment variables. MFC after: 1 month
* In the case of non-sequential mappings, ofw_mapmem() could ask Opennwhitehorn2010-09-021-1/+1
| | | | | | Firmware to map a memory region with negative length, causing crashes and Undefined Behavior. Add the appropriate check to make the behavior defined.
* MF tbemd: Minor tweaks, prefer MACHINE_CPUARCH generally to MACHINE_ARCH ↵imp2010-08-231-2/+2
| | | | (which simplifies some powerpc/powerpc64 ifs)
* Provide support in loader for booting 64-bit PowerPC kernels. Like amd64,nwhitehorn2010-07-124-1/+111
| | | | | 64-bit PowerPC kernels are loaded by a 32-bit loader, since nearly all powerpc64 firmwares execute in 32-bit mode.
* (S)LIST_HEAD_INITIALIZER takes a (S)LIST_HEAD as an argument.antoine2009-12-281-1/+1
| | | | | | | | | 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
* Don't close OF disk devices on PowerPC. This fixes loader when booting fromnwhitehorn2008-10-131-0/+2
| | | | disk on my Blue & White G3 system.
* Backout rev 183181. It appears that I should have been using boot-devicesobomax2008-09-192-30/+1
| | | | | | | 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.
* On PowerPC send output to both "/chosen/stdout" and "screen" nodes, unlesssobomax2008-09-192-1/+30
| | | | | | | | | | | | | 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)
* Enable GCC stack protection (aka Propolice) for userland:ru2008-06-251-0/+3
| | | | | | | | | | | | | | | | | | | | | - 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>
* Make the openfirmware getchar entry point non-blocking. This catches upgrehan2008-02-061-4/+4
| | | | | | with jhb's 2005/05/27 loader multiple-console change. Tested by: marius/sparc64, grehan/ofwppc
* - Make better use of the global chosen, memory and mmu handles insteadmarius2007-06-177-281/+18
| | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Sync the styles of sys/boot/ofw/libofw/openfirm.c andmarius2007-06-161-376/+275
| | | | | sys/dev/ofw/openfirm.c with themselves, with each-other and with style(9).
* Extend struct devdesc with a unit field, called d_unit. Promote themarcel2006-11-021-0/+1
| | | | | | | | | 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.
* Don't unconditionally compile-in the bcache code. It's only used onmarcel2006-11-021-5/+0
| | | | | i386/amd64 and pc98. Remove useless calls to bcache_init() from the ia64 and sparc64 loaders, as well as from the OFW common code.
* more sun4v fallout - missed addkmacy2006-10-091-0/+143
| | | | Approved by: rwatson (mentor)
* add sun4v support to the sparc64 boot loaderkmacy2006-10-092-1/+15
| | | | | | Approved by: rwatson (mentor) Reviewed by: jmg Tested by: kris, dwhite, and jmg
* - Add a workaround for the fact that OFW doesn't guarantee thatmarius2005-10-251-7/+58
| | | | | | | | | | | | | devices can be opened multiple times simultaneously but we're expected to be able to do so by the rest of the loader. This fixes booting from disks attached to the on-board SCSI controller of Sun Ultra 1 (previously this triggered a trap) and probably also of AX1115 boards. - While here, remove unused variables and add empty lines where style(9) requires such. Tested on: powerpc (grehan), sparc64 MFC after: 1 month
* In ofw_parsedev() check the return value of malloc() and protectmarius2005-10-251-1/+5
| | | | | | | against a NULL pointer dereference when ofw_parsedev() is called with a NULL path argument. Tested on: powerpc (grehan), sparc64
* Use an ihandle_t to store the instance handle of an opened devicemarius2005-10-201-1/+1
| | | | | instead of a phandle_t (package handle). Since both are typedefed to unsigned int, this is more or less cosmetic.
* Remove unused variables.marius2005-10-204-7/+0
|
* Make code match comment: make the smallest unit of page allocationgrehan2005-07-221-3/+5
| | | | | | | | | | | from OpenFirmware be 16 pages to avoid fragmentation in the list of mappings returned when the kernel requests it in pmap_bootstrap. This allows a static buffer to be used when obtaining the existing mappings - very useful on the G5 when random physical pages can't be grabbed because they can't be BAT-mapped. MFC after: 3 days
* Since the BAT mapping was removed a long time back, it can'tgrehan2005-05-241-1/+6
| | | | | | | | | | | be assumed that modules are contiguous in memory (they're not) so don't blindly __syncicache start/end. In fact, don't bother syncing the icache for modules since the kernel will do it after fixing up relocations. This fixes the trap when loading modules at boot time. Reported by: orlando at break dot net
* Change ofw_readin/ofw_copyin to map the entire region beforegrehan2005-05-191-24/+74
| | | | | | | | | | | copying, rather than a page at a time. This was creating far too many single-page mappings, and eventually OFW overflowed some internal data structure and refused to map any more. The new algorithm creates far less mappings and fixed a bug where multiple mappings for the same page would be created. 'Twas known this was a problem, but only became urgent when the install CD's mfs_root grew large enough to cause the overflow.
* Remove unused variables.marius2005-03-021-3/+0
|
* Start each of the license/copyright comments with /*-imp2005-01-059-11/+11
|
* For variables that are only checked with defined(), don't provideru2004-10-241-1/+1
| | | | any fake value.
* Instead of "OpenFirmware", "openfirmware", etc. use the official spellingmarius2004-08-165-7/+7
| | | | | | "Open Firmware" from IEEE 1275 and OpenFirmware.org (no pun intended). Ok'ed by: tmm
* G5 support: handle the case where the OpenFirmware memory array usesgrehan2004-08-023-29/+90
| | | | 64 bits for the phys address, but only 32 for the virtual address.
* All hell breaks loose if the loader image is released beforegrehan2004-07-081-1/+3
| | | | | | | jumping to the kernel. Another bug exposed by removing the 1:1 BAT mapping. Sparc64 doesn't do this either. Compile tested on: panther (sparc64). Code built, but not used, on sparc64.
* Correctly calculate size of memory to be mapped when copying. Removalgrehan2004-07-081-1/+3
| | | | | | | of the 256Mb 1:1 BAT mapping exposed this as copying into memory that hadn't been claimed from OpenFirmware. compiled-tested on: panther (sparc64). Code built, but not used, on sparc64
OpenPOWER on IntegriCloud