summaryrefslogtreecommitdiffstats
path: root/sys/boot/ofw
Commit message (Collapse)AuthorAgeFilesLines
* 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
* Extract entry point from elf header before releasing the heap.grehan2004-07-081-1/+3
| | | | | | | This caused a data-miss trap when the BAT init code was removed on PPC. Compile tested on: panther (sparc64). Code built, but not used, on sparc64.
* Convert to __FBSDID.obrien2004-01-0412-23/+37
|
* - Add ':' as a separator between the OpenFirmware device space andgrehan2003-12-212-3/+4
| | | | | | | the file path. Commonly used on Macs e.g. "hd:9". - Update the ofw_setcurrdev routine to match libstand setenv prototype Not objected to by: sparc64
* Make __elfN(ofw_loadfile) match parameter declaration for file_formatgrehan2003-12-211-1/+4
| | | | | | | in boot/common/bootstrap.h. Having a 32-bit size when a 64-bit param is declared wreaks havoc on PPC. Not objected to by: sparc64
* Only print out an error if returned data size is < 0. A value of 0grehan2003-12-211-1/+2
| | | | | | happens almost every time at the end of a file when using NFS. No objection by: sparc64
* Use daddr_t instead of u_long for byte offset in strategygrehan2003-12-211-1/+1
| | | | | | routine to avoid >4G truncation on 32-bit systems. no objection by: sparc64
* - use correct pointer arithmetic in heapsize calculationgrehan2003-12-211-7/+29
| | | | | | - handle multiple Ofw memory regions when determining mem size - allow currdev to be set as a loader command-line option. parse() is used to allow future options to be processed.
* Enable the i386 loader to load and run an amd64 kernel. If this putspeter2003-05-011-5/+5
| | | | | | | | | | | | | | | things over floppy size limits, I can exclude it for release builds or something like that. Most of the changes are to get the load_elf.c file into a seperate elf32_ or elf64_ namespace so that you can have two ELF loaders present at once. Note that for 64 bit kernels, it actually starts up the kernel already in 64 bit mode with paging enabled. This is really easy because we have a known minimum feature set. Of note is that for amd64, we have to pass in the bios int 15 0xe821 memory map because once in long mode, you absolutely cannot make VM86 calls. amd64 does not use 'struct bootinfo' at all. It is a pure loader metadata startup, just like sparc64 and powerpc. Much of the infrastructure to support this was adapted from sparc64.
* Cut&Paste considered far too easy:phk2003-04-162-2/+0
| | | | Don't include <sys/disklabel.h>
* Fix a dumb bug that broke net booting on sparc64. The wrong length wasjake2002-12-021-1/+1
| | | | | | | | passed to strncmp. Noticed by: tmm Approved by: re Pointy hat to: jake
* Change the device path representation in libofw to use the full firmwarejake2002-11-106-579/+62
| | | | | | | | | path, instead of an internal i386 specific one. Don't try to interpret a disklabel in ofw_disk.c, open the partition's device node directly and let the firmware do it. This fixes booting from a partition other than 'a' on sparc64, which is needed to support more installation methods. No objection: ppc
* Major rework of how we copy data into kernel space.benno2002-07-186-22/+36
| | | | | We now talk to the memory and mmu instances directly rather than using the OpenFirmware "claim" method.
OpenPOWER on IntegriCloud