summaryrefslogtreecommitdiffstats
path: root/sys/boot/sparc64/loader/main.c
Commit message (Collapse)AuthorAgeFilesLines
* - The method introduced as part of r234898 for not altering the boot pathmarius2013-06-091-24/+24
| | | | | | | | | | | | | when booting from ZFS turned out to also cause the boot path not being adjusted if booting from CD-ROM with firmware versions that do not employ the "cdrom" alias in that case. So shuffle the code around instead in order to achieve the original intent. Ideally, we shouldn't fiddle with the boot path when booting from UFS on a disk either; unfortunately, there doesn't seem to be an universal way of telling disks and CD-ROMs apart, though. [1] - Use NULL instead of 0 for pointers. PR: 179289 MFC after: 1 week
* zfs/sparc64 boot: fix booting after r242230avg2013-01-201-8/+12
| | | | | | | | | | arch_zfs_probe method is supposed to only probe for ZFS vdevs, but it can not expect that ZFS data is in a ready state yet. So, move some code from sparc64_zfs_probe to main to meet the constraints. Reported by: Chris Ross <cross+freebsd@distal.com> Tested by: Chris Ross <cross+freebsd@distal.com> MFC after: 4 days
* Slightly reduce an overhead for the open() call in the zfsloader.ae2012-09-111-3/+3
| | | | | | libstand(3) tries to detect file system in the predefined order, but zfsloader usually is used for the booting from ZFS, and there is no need to try detect several file system types for each open() call.
* Pull the tier-2 card and change the sparc64 ZFS loader to no longer probemarius2012-07-271-9/+43
| | | | | | | | | | | | all diskN aliases for providers (which more or less corresponds to how the x86 version behaves) but instead probe only those listed in the boot-device OFW environment variable. This has the following advantages: - avoids otherwise unavoidable OFW warnings about failures to open disks for which aliases exist but no actual hardware is connected - avoids issues due to different diskN naming schemes - aligns us with Solaris MFC after: 3 days
* The loaddev environment variable is not modifiable once set, so it is notmarius2012-06-041-14/+16
| | | | | | | | | update for ZFS. It seems that this does not really affect anything except the help command. Nevertheless, rearrange things so loaddev is set only once in all cases in order to get it right. Pointed out by: avg MFC after: r235364
* sparc64/zfs boot: take advantage of new libzfsboot capabilitiesavg2012-05-121-56/+23
| | | | | | | Also drop the now unneeded compatibility shims. Tested by: marius MFC after: 1 month
* zfsboot/zfsloader: support accessing filesystems within a poolavg2012-05-121-3/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In zfs loader zfs device name format now is "zfs:pool/fs", fully qualified file path is "zfs:pool/fs:/path/to/file" loader allows accessing files from various pools and filesystems as well as changing currdev to a different pool/filesystem. zfsboot accepts kernel/loader name in a format pool:fs:path/to/file or, as before, pool:path/to/file; in the latter case a default filesystem is used (pool root or bootfs). zfsboot passes guids of the selected pool and dataset to zfsloader to be used as its defaults. zfs support should be architecture independent and is provided in a separate library, but architectures wishing to use this zfs support still have to provide some glue code and their devdesc should be compatible with zfs_devdesc. arch_zfs_probe method is used to discover all disk devices that may be part of ZFS pool(s). libi386 unconditionally includes zfs support, but some zfs-specific functions are stubbed out as weak symbols. The strong definitions are provided in libzfsboot. This change mean that the size of i386_devspec becomes larger to match zfs_devspec. Backward-compatibility shims are provided for recently added sparc64 zfs boot support. Currently that architecture still works the old way and does not support the new features. TODO: - clear up pool root filesystem vs pool bootfs filesystem distinction - update sparc64 support - set vfs.root.mountfrom based on currdev (for zfs) Mid-future TODO: - loader sub-menu for selecting alternative boot environment Distant future TODO: - support accessing snapshots, using a snapshot as readonly root Reviewed by: marius (sparc64), Gavin Mu <gavin.mu@gmail.com> (sparc64) Tested by: Florian Wagner <florian@wagner-flo.net> (x86), marius (sparc64) No objections: fs@, hackers@ MFC after: 1 month
* sys/boot: add common CTASSERT definitionavg2012-05-091-6/+0
|
* Add initial support for booting from ZFS on sparc64. At least on Sun Firemarius2012-05-011-9/+100
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Add a command for showing the heap usage.marius2012-05-011-0/+12
| | | | | | PR: 165025 Submitted by: Gavin Mu MFC after: 1 week
* - For Cheetah- and Zeus-class CPUs don't flush all unlocked entries frommarius2011-07-021-25/+63
| | | | | | | | | | | | | | | | | | | the TLBs in order to get rid of the user mappings but instead traverse them an flush only the latter like we also do for the Spitfire-class. Also flushing the unlocked kernel entries can cause instant faults which when called from within cpu_switch() are handled with the scheduler lock held which in turn can cause timeouts on the acquisition of the lock by other CPUs. This was easily seen with a 16-core V890 but occasionally also happened with 2-way machines. While at it, move the SPARC64-V support code entirely to zeus.c. This causes a little bit of duplication but is less confusing than partially using Cheetah-class bits for these. - For SPARC64-V ensure that 4-Mbyte page entries are stored in the 1024- entry, 2-way set associative TLB. - In {d,i}tlb_get_data_sun4u() turn off the interrupts in order to ensure that ASI_{D,I}TLB_DATA_ACCESS_REG actually are read twice back-to-back. Tested by: Peter Jeremy (16-core US-IV), Michael Moll (2-way SPARC64-V)
* Disconnect sun4v architecture from the three.attilio2011-05-141-70/+1
| | | | | | | | | Some files keep the SUN4V tags as a code reference, for the future, if any rewamped sun4v support wants to be added again. Reviewed by: marius Tested by: sbruno Approved by: re
* Revert rev 165325. The arch_maphint interface hasn't been in use formarcel2011-04-031-46/+0
| | | | more than 4 years.
* Partially revert r203829; as it turns out what the PowerPC OFW loader didmarius2010-10-291-4/+4
| | | | | | | | was incorrect as further down the road cons_probe() calls malloc() so the former can't be called before init_heap() has succeed. Instead just exit to the firmware in case init_heap() fails like OF_init() does when hitting a problem as we're then likely running in a very broken environment where hardly anything can be trusted to work.
* Add support for SPARC64 V (and where it already makes sense for othermarius2010-05-021-2/+6
| | | | | | | | | HAL/Fujitsu) CPUs. For the most part this consists of fleshing out the MMU and cache handling, it doesn't add pmap optimizations possible with these CPU, yet, though. With these changes FreeBSD runs stable on Fujitsu Siemens PRIMEPOWER 250 and likely also other models based on SPARC64 V like 450, 650 and 850. Thanks go to Michael Moll for providing access to a PRIMEPOWER 250.
* Some machines can not only consist of CPUs running at different speedsmarius2010-02-201-1/+1
| | | | | | | | | but also of different types, f.e. Sun Fire V890 can be equipped with a mix of UltraSPARC IV and IV+ CPUs, requiring different MMU initialization and different workarounds for model specific errata. Therefore move the CPU implementation number from a global variable to the per-CPU data. Functions which are called before the latter is available are passed the implementation number as a parameter now.
* Correct the panic strings introduced in r203830 to match their arguments.marius2010-02-131-4/+4
|
* Use the SUNW,{d,i}tlb-load methods for entering locked TLB entries likemarius2010-02-131-48/+26
| | | | | | | | | | OpenBSD and OpenSolaris do instead of fiddling with the MMUs ourselves. Unlike direct access the firmware methods don't automatically use the next free (?) TLB slot, instead the slot to be used has to be specified. We allocate the TLB slots for the kernel top-down as OpenSolaris suggests that the firmware will always allocate the ones for its own use bottom-up. Besides being simpler, according to OpenBSD using the firmware methods is required to allow booting on Sun Fire E10K with multi-systemboard domains.
* - Assert that HEAPSZ is a multiple of PAGE_SIZE as at least the firmwaremarius2010-02-131-34/+115
| | | | | | | | | | | | | | | | | | | | | | | | | | | of Sun Fire V1280 doesn't round up the size itself but instead lets claiming of non page-sized amounts of memory fail. - Change parameters and variables related to the TLB slots to unsigned which is more appropriate. - Search the whole OFW device tree instead of only the children of the root nexus device for the BSP as starting with UltraSPARC IV the 'cpu' nodes hang off of from 'cmp' (chip multi-threading processor) or 'core' or combinations thereof. Also in large UltraSPARC III based machines the 'cpu' nodes hang off of 'ssm' (scalable shared memory) nodes which group snooping-coherency domains together instead of directly from the nexus. - Add support for UltraSPARC IV and IV+ BSPs. Due to the fact that these are multi-core each CPU has two Fireplane config registers and thus the module/target ID has to be determined differently so the one specific to a certain core is used. Similarly, starting with UltraSPARC IV the individual cores use a different property in the OFW device tree to indicate the CPU/core ID as it no longer is in coincidence with the shared slot/socket ID. While at it additionally distinguish between CPUs with Fireplane and JBus interconnects as these also use slightly different sizes for the JBus/agent/module/target IDs. - Check the return value of init_heap(). This requires moving it after cons_probe() so we can panic when appropriate. This should be fine as the PowerPC OFW loader uses that order for quite some time now.
* Execute the cleanup handlers before jumping to the kernel justmarius2009-12-241-0/+2
| | | | like the other architectures do.
* Revert r183628 as with the current ata(4) ATAPI DMA with AcerLabsmarius2009-12-241-1/+0
| | | | | | 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.
* Fix masking of TTE bits; the TD_*_MASK macros need shifting via themarius2009-04-141-5/+7
| | | | | | corresponding TD_*_SHIFT. MFC after: 3 days
* Fix whitespace.marius2009-04-131-3/+3
|
* - Use the generally more appropriate PROM base rather than themarius2009-02-101-4/+4
| | | | | | | | | 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[].
* Disable ATAPI DMA as it's once again broken in that it causes datamarius2008-10-051-1/+1
| | | | | | | corruption with the on-board AcerLabs M5229 controllers. While at it, remove the pointless "nothing to autoload yet." message. MFC after: 3 days
* Work around Cheetah+ erratum 34 (USIII+ erratum #10) by relocatingmarius2008-09-101-0/+110
| | | | | | | | 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.
* USIII and beyond CPUs have stricter requirements when it comesmarius2008-09-081-1/+2
| | | | | | | | | | | | | | | | | | 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
* Ensure interrupts are off while in {d,i}tlb_va_to_pa_sun4u().marius2008-09-041-2/+10
| | | | | I think this is necessary in order to make sure the workarounds in {d,i}tlb_get_data_sun4u() work correctly.
* - Read ASI_{D,I}TLB_DATA_ACCESS_REG twice in order to work aroundmarius2008-08-301-21/+60
| | | | | | | | | | | | | | | 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.
* cosmetic changes and style fixesmarius2008-08-221-4/+7
|
* - Reimplement {d,i}tlb_enter() and {d,i}tlb_va_to_pa() in C. There'smarius2008-08-071-40/+98
| | | | | | | | | | | | | | | 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.
* - Make better use of the global chosen, memory and mmu handles insteadmarius2007-06-171-52/+78
| | | | | | | | | | | | | | | | | | | | | | | | | 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.
* - Remove dupe and unused declarations and prototypes.marius2007-06-161-67/+54
| | | | | | | | - 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.
* add an interface for passing the entire kernel size up front to thekmacy2006-12-181-1/+50
| | | | | loader so that it can memory can be allocated aligned at the beginning of the desired large page
* Don't unconditionally compile-in the bcache code. It's only used onmarcel2006-11-021-2/+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.
* unbreak sparc64 loader buildkmacy2006-10-091-1/+0
| | | | | | | | re-add accidentally deleted asi value remove sun4v only header include Approved by: rwatson (mentor) Reviewed by: jmg
* add sun4v support to the sparc64 boot loaderkmacy2006-10-091-8/+107
| | | | | | Approved by: rwatson (mentor) Reviewed by: jmg Tested by: kris, dwhite, and jmg
* Start each of the license/copyright comments with /*-imp2005-01-051-1/+1
|
* Back out v1.24. v1.40 of sys/sparc64/sparc64/bus_machdep.c fixes thekensmith2004-09-081-3/+1
| | | | | | problem this hack was put in place for. MFC to be done if the fix to bus_machdep.c is MFC-ed.
* Temporary bandaid to help sparc64 systems with ATA disks boot. Recentkensmith2004-08-191-1/+3
| | | | | | | | | | | changes to the ATA driver cause a kernel crash, no fault of the ATA code. Work is in progress to add the necessary feature to the sparc64 kernel and this commit will be backed out when it is complete. This bandaid is being put in mostly in the interests of getting the first release snapshot done and out the door. Tested on: Ultra-10 exhibiting the insta-panic. MFC: Real Soon
* Instead of "OpenFirmware", "openfirmware", etc. use the official spellingmarius2004-08-161-1/+1
| | | | | | "Open Firmware" from IEEE 1275 and OpenFirmware.org (no pun intended). Ok'ed by: tmm
* Convert to __FBSDID.obrien2004-01-041-2/+4
|
* NFS support should be conditional on LOADER_NFS_SUPPORT, nottmm2003-07-111-1/+1
| | | | LOADER_NET_SUPPORT.
* Remember to release the loader's heap.jake2003-06-151-1/+7
| | | | Reviewed by: tmm
* Commit a missed change to keep in sync with the MI elf loader.peter2003-05-011-4/+4
|
* Renamed the loader's zipfs to gzipfs. zipfs.c was repo-copied to gzipfs.c.jake2002-12-191-1/+4
|
* Change the device path representation in libofw to use the full firmwarejake2002-11-101-35/+17
| | | | | | | | | 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
* Compile in support for zipfs and bzipfs so we can load the gzipped mfsrootjake2002-10-131-0/+6
| | | | that releases use.
* - Do not pretend to compile a kernel and remove the definitionrobert2002-08-211-2/+0
| | | | | | | of the _KERNEL macro. - Do not include <sys/pcpu.h> for no reason. Suggested by: jake
* - Define the macro _KERNEL to pretend we are compiling a kernel.robert2002-08-211-1/+2
| | | | | | | | | | This is required by recent changes to <sys/pcpu.h>, which uses the #error preprocessor directive to keep non-kernel applications from using it. _KERNEL is defined below the #include <stand.h>, because <stand.h> removes the definition of _KERNEL. - Move the inclusion of <sys/queue.h> above the inclusion of <sys/linker.h> to avoid syntax errors.
OpenPOWER on IntegriCloud