History log of /freebsd-9.3-release/sys/boot/sparc64/loader/main.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 267654 19-Jun-2014 gjb

Copy stable/9 to releng/9.3 as part of the 9.3-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

# 252296 27-Jun-2013 marius

MFC: r251589

- The method introduced as part of r234898 (MFCed to stable/9 in r236076)
for not altering the boot path 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 [1]


# 245943 26-Jan-2013 avg

MFC r245697: zfs/sparc64 boot: fix booting after r242230


# 243243 18-Nov-2012 ae

MFC 239054,239057,239058,239060,239066,239067,239068,239070,239073,
239087,239088,239127,239210,239211,239230,239231,239232,239243,
239292,239293,239294,239325,240272,240273,240274,240275,240276,
240277,240335,240481,241023,241047,241053,241065,241068,241069,
241070,241164,241809,241876

239054:
Create the interface to work with various partition tables from the
loader(8). The following partition tables are supported: BSD label, GPT,
MBR, EBR and VTOC8.
239057:
Remove unused variables.
239058:
Introduce new API to work with disks from the loader's drivers.
It uses new API from the part.c to work with partition tables.
239060:
When GPT signature is invalid in the primary GPT header, then try to
read backup GPT header.
239066:
Add offset field to the i386_devdesc structure to be compatible with
disk_devdesc structure. Update biosdisk driver to the new disk API.
239067:
Remove unneeded flag.
239068:
Teach the ZFS use new partitions API when probing.
Note: now ZFS does probe only for partitions with type "freebsd-zfs"
and "freebsd".
239070:
Add simple test program that uses the partition tables handling code.
It is useful to test and debug how boot loader handles partition tables
metadata.
239073:
Bump USERBOOT_VERSION.
239087:
Add to the debug output the offset from the parent partitioning scheme.
239088:
Fix start offset calculation for the EBR partitions.
239127:
As it turned out, there are some installations, where BSD label
contains partitions with type zero. And it has worked.
So, allow detect these partitions.
239210:
Add more debug messages.
239211:
Add another debug message.
239230:
Unbreak booting from the true dedicated disks.
When we open the disk, check the type of partition table, that has
been detected. If this is BSD label, then we assume this is DD mode.
239231:
Remove colons from the debug message, device name returned by the
disk_fmtdev() already has the colons.
239232:
Restore the old behaviour. If requested partition is a BSD slice,
but d_partition isn't explicitly set, then try to open BSD label and its
first partition.
239243:
After r239066, reinitialize v86.ctl and v86.addr for int 13 EDD probing
in sys/boot/i386/libi386/biosdisk.c. Otherwise, when DISK_DEBUG is
enabled, the DEBUG() macros will clobber those fields, and cause the
probing to always fail mysteriously when debugging is enabled.
239292:
Explicitly terminate the string after strncpy(3).
239293:
Rework r239232 to unbreak ZFS detection on MBR slices.
239294:
Some BIOSes return incorrect number of sectors, make checks less
strictly, to do not lost some partitions.
239325:
Add comment why the code has been disabled.
240272:
Make struct uboot_devdesc compatible with struct disk_devdesc.
240273:
Use disk_fmtdev() and disk_parsedev() functions from the new DISK API.
240274:
Update uboot's disk driver to use new DISK API.
240275:
Build disk.c only when DISK_SUPPORT is enabled.
240276:
Update according to the change of struct uboot_devdesc.
240277:
Handle LOADER_NO_DISK_SUPPORT knob in the arm and powerpc ubldr.
240335:
Slightly reduce an overhead for the open() call in the zfsloader.
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.
240481:
The MBR data is not necessarily aligned. This is a problem on ARM.
241023:
Make the loader a bit smarter, when it tries to open disk and the slice
number is not exactly specified. When the disk has MBR, also try to read
BSD label after ptable_getpart() call. When the disk has GPT, also set
d_partition to 255. Mostly, this is how it worked before.
241047:
Disable splitfs support, since we aren't support floppies for a long
time. This slightly reduces an overhead, when loader tries to open
file that doesn't exist.
241053:
Almost each time when loader opens a file, this leads to calling
disk_open(). Very often this is called several times for one file.
This leads to reading partition table metadata for each call. To
reduce the number of disk I/O we have a simple block cache, but it
is very dumb and more than half of I/O operations related to reading
metadata, misses this cache.

Introduce new cache layer to resolve this problem. It is independent
and doesn't need initialization like bcache, and will work by default
for all loaders which use the new DISK API. A successful disk_open()
call to each new disk or partition produces new entry in the cache.
Even more, when disk was already open, now opening of any nested
partitions does not require reading top level partition table.
So, if without this cache, partition table metadata was read around
20-50 times during boot, now it reads only once. This affects the booting
from GPT and MBR from the UFS.
241065:
Fix disk_cleanup() to work without DISK_DEBUG too.
241068:
Reduce the number of attempts to detect proper kld format for the amd64
loader.
241069:
Remember the file format of the last loaded module and try to use it for
next files.
241070:
Fix the style.
241164:
Replace all references to loader_callbacks_v1 with loader_callbacks.
241809:
Add the flags parameter to the disk_open() function and DISK_F_NOCACHE
flag, that disables the caching of partition tables metadata.
Use this flag for floppies in the libi386/biosdisk driver.
241876:
When loader tries to open GPT partition, but partition table is not GPT,
then try automatically detect an appropriate partition type.


# 238904 30-Jul-2012 marius

Pull the tier-2 card and change the sparc64 ZFS loader to no longer probe
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

Approved by: re (kib)


# 237815 29-Jun-2012 marius

MFC: r236581

The loaddev environment variable is not modifiable once set, so it is not
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


# 237766 29-Jun-2012 avg

MFC r235329,235343,235361,235364: zfsboot/zfsloader: support accessing
filesystems within a pool


# 237752 29-Jun-2012 avg

MFC r235153: sys/boot: add common CTASSERT definition


# 236076 26-May-2012 marius

MFC: r234898, r235207

Add initial support for booting from ZFS on sparc64. At least on Sun Fire
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.

PR: 165025
Submitted by: Gavin Mu


# 235997 25-May-2012 marius

MFC: r234897

Add a command for showing the heap usage.

PR: 165025
Submitted by: Gavin Mu


# 225736 22-Sep-2011 kensmith

Copy head to stable/9 as part of 9.0-RELEASE release cycle.

Approved by: re (implicit)


# 223719 02-Jul-2011 marius

- For Cheetah- and Zeus-class CPUs don't flush all unlocked entries from
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)


# 221869 14-May-2011 attilio

Disconnect sun4v architecture from the three.

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


# 220290 03-Apr-2011 marcel

Revert rev 165325. The arch_maphint interface hasn't been in use for
more than 4 years.


# 214526 29-Oct-2010 marius

Partially revert r203829; as it turns out what the PowerPC OFW loader did
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.


# 207537 02-May-2010 marius

Add support for SPARC64 V (and where it already makes sense for other
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.


# 204152 20-Feb-2010 marius

Some machines can not only consist of CPUs running at different speeds
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.


# 203831 13-Feb-2010 marius

Correct the panic strings introduced in r203830 to match their arguments.


# 203830 13-Feb-2010 marius

Use the SUNW,{d,i}tlb-load methods for entering locked TLB entries like
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.


# 203829 13-Feb-2010 marius

- Assert that HEAPSZ is a multiple of PAGE_SIZE as at least the firmware
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.


# 200946 24-Dec-2009 marius

Execute the cleanup handlers before jumping to the kernel just
like the other architectures do.


# 200944 24-Dec-2009 marius

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.


# 191071 14-Apr-2009 marius

Fix masking of TTE bits; the TD_*_MASK macros need shifting via the
corresponding TD_*_SHIFT.

MFC after: 3 days


# 191012 13-Apr-2009 marius

Fix whitespace.


# 188455 10-Feb-2009 marius

- 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[].


# 183628 05-Oct-2008 marius

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


# 182916 10-Sep-2008 marius

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.


# 182877 08-Sep-2008 marius

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


# 182766 04-Sep-2008 marius

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.


# 182478 30-Aug-2008 marius

- 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.


# 182020 22-Aug-2008 marius

cosmetic changes and style fixes


# 181398 07-Aug-2008 marius

- 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.


# 170854 16-Jun-2007 marius

- 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.


# 170839 16-Jun-2007 marius

- 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.


# 165325 18-Dec-2006 kmacy

add an interface for passing the entire kernel size up front to the
loader so that it can memory can be allocated aligned at the beginning of
the desired large page


# 163893 01-Nov-2006 marcel

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.


# 163151 09-Oct-2006 kmacy

unbreak sparc64 loader build
re-add accidentally deleted asi value
remove sun4v only header include

Approved by: rwatson (mentor)
Reviewed by: jmg


# 163145 09-Oct-2006 kmacy

add sun4v support to the sparc64 boot loader

Approved by: rwatson (mentor)
Reviewed by: jmg
Tested by: kris, dwhite, and jmg


# 139738 05-Jan-2005 imp

Start each of the license/copyright comments with /*-


# 134944 08-Sep-2004 kensmith

Back out v1.24. v1.40 of sys/sparc64/sparc64/bus_machdep.c fixes the
problem this hack was put in place for.

MFC to be done if the fix to bus_machdep.c is MFC-ed.


# 134039 19-Aug-2004 kensmith

Temporary bandaid to help sparc64 systems with ATA disks boot. Recent
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


# 133862 16-Aug-2004 marius

Instead of "OpenFirmware", "openfirmware", etc. use the official spelling
"Open Firmware" from IEEE 1275 and OpenFirmware.org (no pun intended).

Ok'ed by: tmm


# 124139 04-Jan-2004 obrien

Convert to __FBSDID.


# 117448 11-Jul-2003 tmm

NFS support should be conditional on LOADER_NFS_SUPPORT, not
LOADER_NET_SUPPORT.


# 116415 15-Jun-2003 jake

Remember to release the loader's heap.

Reviewed by: tmm


# 114386 01-May-2003 peter

Commit a missed change to keep in sync with the MI elf loader.


# 108100 19-Dec-2002 jake

Renamed the loader's zipfs to gzipfs. zipfs.c was repo-copied to gzipfs.c.


# 106738 10-Nov-2002 jake

Change the device path representation in libofw to use the full firmware
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


# 105065 13-Oct-2002 jake

Compile in support for zipfs and bzipfs so we can load the gzipped mfsroot
that releases use.


# 102226 21-Aug-2002 robert

- Do not pretend to compile a kernel and remove the definition
of the _KERNEL macro.
- Do not include <sys/pcpu.h> for no reason.

Suggested by: jake


# 102219 21-Aug-2002 robert

- Define the macro _KERNEL to pretend we are compiling a kernel.
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.


# 101287 03-Aug-2002 jake

Print out the strings in vers.o instead of hardcoding the loader banner.


# 97510 29-May-2002 jake

Add needed include of queue.h. Remove unneeded include of smp.h.


# 97445 29-May-2002 jake

Use a contrived 'tlb_entry' structure for passing the mappings for the
kernel text and data from the loader to the kernel, so that the tte format
is not part of the loader->kernel ABI.


# 96755 16-May-2002 trhodes

More s/file system/filesystem/g


# 96428 11-May-2002 jake

Attempt to not crash and burn on UltraSPARC III machines; the cpuid property
is named differently.


# 93678 02-Apr-2002 tmm

Do not use semi-fixed TLB slots for the 4M kernel pages any more.


# 93606 01-Apr-2002 tmm

Add support for booting from CD-ROM. Make it possible to enable UFS
support using make arguments.


# 91519 01-Mar-2002 jake

Catch up to change in tte format.

Forgetten by: jake
Submitted by: tmm


# 91139 23-Feb-2002 jake

Keep track of the ttes used to map the kernel and pass them to it as loader
metadata. Modify tlb handling functions to take a tte, instead of virtual
address, physical address and flags.


# 91110 23-Feb-2002 jake

Fix fs support ifdefs. Add tftp support. Add physical and virtual
watchpoint support for debugging (under LOADER_DEBUG). Claim the
physical and virtual addresses used to map the kernel from the prom;
we map it ourselves behind the scenes though. Add a reboot command.

Submitted by: tmm


# 85719 30-Oct-2001 jake

Add definitions for network support, doesn't work yet.
Pass the right arguments to the kernel.
Replace magic numbers with symbolic constants.
Pass the real openfirmware entry point to OF_init.


# 84997 15-Oct-2001 robert

Fix some warnings.


# 84996 15-Oct-2001 robert

Add the FreeBSD/sparc64 boot loader source files.