Commit Graph

47 Commits

Author SHA1 Message Date
Pawel Biernacki
7029da5c36 Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many)
r357614 added CTLFLAG_NEEDGIANT to make it easier to find nodes that are
still not MPSAFE (or already are but aren’t properly marked).
Use it in preparation for a general review of all nodes.

This is non-functional change that adds annotations to SYSCTL_NODE and
SYSCTL_PROC nodes using one of the soon-to-be-required flags.

Mark all obvious cases as MPSAFE.  All entries that haven't been marked
as MPSAFE before are by default marked as NEEDGIANT

Approved by:	kib (mentor, blanket)
Commented by:	kib, gallatin, melifaro
Differential Revision:	https://reviews.freebsd.org/D23718
2020-02-26 14:26:36 +00:00
Jeff Roberson
2194393787 Move phys_avail definition into MI code. It is consumed in the MI layer and
doing so adds more flexibility with less redundant code.

Reviewed by:	jhb, markj, kib
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D21250
2019-08-16 00:45:14 +00:00
Warner Losh
50b1a01ecb Fix compile error introduced in r336245.
Include sys/boot.h to pickup the prototypes for boot_parse_arg.
2018-07-17 23:00:52 +00:00
Warner Losh
eed42ff1d5 Use boot_parse_* to parse command line args and retire cut-n-paste
code that was substantially identical.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D16205
2018-07-13 16:43:17 +00:00
Pedro F. Giffuni
19d3b47b92 sys/mips: further adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.
2017-11-27 15:07:26 +00:00
Alexander Kabaev
bb99420132 Add cavium octeon 'bootoctlinux' boot argument support
While there, parse u-boot provided command line arguments
for supported switches and update boothowto appropriately.
Also support setting kenv variables from the kernel comman
line.

PR:	216831 (modified)
2017-03-16 00:49:59 +00:00
Attilio Rao
590f9303e5 Merge from vmobj-rwlock branch:
Remove unused inclusion of vm/vm_pager.h and vm/vnode_pager.h.

Sponsored by:	EMC / Isilon storage division
Tested by:	pho
Reviewed by:	alc
2013-02-26 01:00:11 +00:00
Juli Mallett
85129b4bd4 Use bootverbose to control debug printfs from the Cavium Simple Executive
code.  Also remove an unnecessary CVMX_ENABLE_DEBUG_PRINTS conditional around
what is already a cvmx_dprintf.
2012-11-24 02:12:24 +00:00
Juli Mallett
01a310bd57 o) Add support for specifying a model of Octeon to target at compile-time,
reducing the number of runtime checks done by the SDK code.
o) Group board/CPU information at early startup by subject matter, so that e.g.
   CPU information is adjacent to CPU information and board information is
   adjacent to board information.
2012-11-24 02:00:29 +00:00
Juli Mallett
8961aadb2b o) Do boot descriptor parsing before console setup so that we can use a console
other than UART 0 from the outset.
o) Print board information from sysinfo after consoles have been initialized
   rather than doing it during boot descriptor parsing.
o) Use cvmx_safe_printf and platform_reset rather than panic when doing very
   early boot descriptor parsing before the console is set up.
o) Get rid of the global octeon_bootinfo.
2012-11-19 00:19:27 +00:00
Juli Mallett
3631682eab Actually check board type rather than using a specialized octeon_is_simulation
function.
2012-10-30 06:36:14 +00:00
Juli Mallett
d1d2f57d4a Remove stale declarations. 2012-10-30 06:19:46 +00:00
Juli Mallett
684ba62e3f Speed feature tests and initialize helper configuration that some CPUs require. 2012-10-30 06:07:30 +00:00
Juli Mallett
0a5f2ecced Add a sysctl to change the LED display. 2012-10-29 07:06:23 +00:00
Juli Mallett
a1d1611d51 Wrap some long lines and display board serial numbers at boot. 2012-10-29 02:10:20 +00:00
Juli Mallett
1f51baaa92 Use Simple Executive LED display routines, which correctly use the LED base
address passed from the bootloader, rather than using a hard-coded value.

Make FreeBSD announce itself on the LED display similar to other kernels.

Remove uses of the previous LED routines, which were under-used and only used
in drivers for what seem like debugging purposes, despite those drivers being
widely-tested.

Remove several inlines for accessing memory that duplicate other functions
which are now used instead, as they are now entirely unused.
2012-10-29 00:51:53 +00:00
Oleksandr Tymoshenko
5e608d0b09 Remap PMC interrupt for all cores 2012-03-24 06:28:15 +00:00
Oleksandr Tymoshenko
ae849c7c42 Setup fake MODINFO variables for octeon kernel 2012-03-23 00:01:09 +00:00
Juli Mallett
dc4ee6ca91 Merge the Cavium Octeon SDK 2.3.0 Simple Executive code and update FreeBSD to
make use of it where possible.

This primarily brings in support for newer hardware, and FreeBSD is not yet
able to support the abundance of IRQs on new hardware and many features in the
Ethernet driver.

Because of the changes to IRQs in the Simple Executive, we have to maintain our
own list of Octeon IRQs now, which probably can be pared-down and be specific
to the CIU interrupt unit soon, and when other interrupt mechanisms are added
they can maintain their own definitions.

Remove unmasking of interrupts from within the UART device now that the
function used is no longer present in the Simple Executive.  The unmasking
seems to have been gratuitous as this is more properly handled by the buses
above the UART device, and seems to work on that basis.
2012-03-11 06:17:49 +00:00
Juli Mallett
3b7eabb569 Unbreak SMP on stock Octeon systems -- copy the core_mask from bootinfo into
sysinfo.  This should have been done as part of replacing bootinfo with sysinfo.
2012-03-02 20:34:15 +00:00
Oleksandr Tymoshenko
27e093e7f4 - Initialize compact_flash_attribute_base_addr from bootinfo structure 2011-12-24 23:15:25 +00:00
Oleksandr Tymoshenko
5a312a4a9a - Set CF physical address base in sysinfo structure 2011-12-23 22:10:55 +00:00
Oleksandr Tymoshenko
ba3ba72812 - Copy base MAC address from bootinfo descriptor to sysinfo struct
Reviewed by:	Andrew Duane
2011-11-28 19:28:29 +00:00
Warner Losh
f381c26847 Save the CPU model, the board and the CPU clock rate so they are reported by
the approrpiate sysctl.
2011-01-17 23:03:09 +00:00
Juli Mallett
1dadcedcfc When allocating memory from bootmem for the kernel to use, try to leave about
2MB of memory in the bootmem allocator for the SDK to use internally at a later
point.  It'd be nice if there were some functions we could call before
allocating memory to let various facilities reserve some memory, but for now
this seems sufficient.  Previously some unfortunate systems could give up all
(or at least most) of their memory to the kernel from bootmem, and then
allocating command queues for packet output and the like would fail later in
the boot process (which in turn would lead to crashes even later.)

Reported by:	kan
2010-12-28 20:11:54 +00:00
Oleksandr Tymoshenko
bd01e50ca0 - dump_avail layout should be sequence of [start, end)
pairs, not <start, size>.

Spotted by: alc@
2010-12-09 07:47:40 +00:00
Oleksandr Tymoshenko
99629fa36d - Populate dump_avail with proper values from phys_avail 2010-12-09 07:01:03 +00:00
Juli Mallett
6d903e0c7a Display some Octeon 2 features and a feature for distinguishing between PCIe
implementations.
2010-11-30 01:27:54 +00:00
Juli Mallett
04b6fa8330 Merge Cavium Octeon SDK 2.0 Simple Executive; this brings some fixes and new
facilities as well as support for the Octeon 2 family of SoCs.

XXX Note that with our antediluvian assembler, we can't support some Octeon 2
    instructions and fall back to using the old ones instead.
2010-11-28 08:18:16 +00:00
Juli Mallett
ed48d90907 Don't use memory that can't be direct-mapped on !n64. 2010-09-19 09:18:07 +00:00
Juli Mallett
cea2b8b915 Update the port of FreeBSD to Cavium Octeon to use the Cavium Simple Executive
library:
o) Increase inline unit / large function growth limits for MIPS to accommodate
   the needs of the Simple Executive, which uses a shocking amount of inlining.
o) Remove TARGET_OCTEON and use CPU_CNMIPS to do things required by cnMIPS and
   the Octeon SoC.
o) Add OCTEON_VENDOR_LANNER to use Lanner's allocation of vendor-specific
   board numbers, specifically to support the MR320.
o) Add OCTEON_BOARD_CAPK_0100ND to hard-wire configuration for the CAPK-0100nd,
   which improperly uses an evaluation board's board number and breaks board
   detection at runtime.  This board is sold by Portwell as the CAM-0100.
o) Add support for the RTC available on some Octeon boards.
o) Add support for the Octeon PCI bus.  Note that rman_[sg]et_virtual for IO
   ports can not work unless building for n64.
o) Clean up the CompactFlash driver to use Simple Executive macros and
   structures where possible (it would be advisable to use the Simple Executive
   API to set the PIO mode, too, but that is not done presently.)  Also use
   structures from FreeBSD's ATA layer rather than structures copied from
   Linux.
o) Print available Octeon SoC features on boot.
o) Add support for the Octeon timecounter.
o) Use the Simple Executive's routines rather than local copies for doing reads
   and writes to 64-bit addresses and use its macros for various device
   addresses rather than using local copies.
o) Rename octeon_board_real to octeon_is_simulation to reduce differences with
   Cavium-provided code originally written for Linux.  Also make it use the
   same simplified test that the Simple Executive and Linux both use rather
   than our complex one.
o) Add support for the Octeon CIU, which is the main interrupt unit, as a bus
   to use normal interrupt allocation and setup routines.
o) Use the Simple Executive's bootmem facility to allocate physical memory for
   the kernel, rather than assuming we know which addresses we can steal.
   NB: This may reduce the amount of RAM the kernel reports you as having if
       you are leaving large temporary allocations made by U-Boot allocated
       when starting FreeBSD.
o) Add a port of the Cavium-provided Ethernet driver for Linux.  This changes
   Ethernet interface naming from rgmxN to octeN.  The new driver has vast
   improvements over the old one, both in performance and functionality, but
   does still have some features which have not been ported entirely and there
   may be unimplemented code that can be hit in everyday use.  I will make
   every effort to correct those as they are reported.
o) Support loading the kernel on non-contiguous cores.
o) Add very conservative support for harvesting randomness from the Octeon
   random number device.
o) Turn SMP on by default.
o) Clean up the style of the Octeon kernel configurations a little and make
   them compile with -march=octeon.
o) Add support for the Lanner MR320 and the CAPK-0100nd to the Simple
   Executive.
o) Modify the Simple Executive to build on FreeBSD and to build without
   executive-config.h or cvmx-config.h.  In the future we may want to
   revert part of these changes and supply executive-config.h and
   cvmx-config.h and access to the options contained in those files via
   kernel configuration files.
o) Modify the Simple Executive USB routines to support getting and setting
   of the USB PID.
2010-07-20 19:25:11 +00:00
Juli Mallett
5f3173b517 o) Fix XKPHYS physical address extraction. Also define cache coherency
attributes for XKPHYS.
o) Make coprocessor 0 accessor function macros for register+selector registers
   take the full name so that e.g. (as done in this commit), prid selector 1
   can be written through mips_wr_ebase() rather than mips_wr_prid1().
o) Allow for sign extension of 32-bit segment addresses.
o) Remove an unused MIPS-I register number.
2010-04-19 06:01:58 +00:00
Juli Mallett
b6777295a6 o) Add SMP support for Octeon using U-Boot to launch all the processors at the
same time.
o) Remove some unused trivial uart functions from octeon_machdep now that the
   uart part is fully working and they are unused.
o) Use __func__ instead of __FUNCTION__.
o) Use intr_*() instead of other routines that do the same thing.
o) Remove some duplicate printfs from the Octeon port, as well as duplicate
   setting of Maxmem.
o) Use the right frequency divider on Octeon.
o) Use PCPU_GET(cpuid) consistently to get the cpuid of the running core.
o) Remove some unused macros in the Octeon port.
o) Use mips_sync() around use of the global dpcpu, whose value may not be
   visible to APs at first.
o) When loading the first thread's stack, use macros to make the code correct
   for n64 as well.
o) Remove stub, do-nothing FAU init/enable/disable functions from the RGMX
   driver.
2010-04-17 03:08:13 +00:00
Juli Mallett
9b98f51885 Don't force single user on Octeon anymore. 2010-03-11 22:25:53 +00:00
Juli Mallett
54e3435255 Properly detect a type of real board that claims to have a 0.0 revision.
This fixes at least memory detection on that board.

Sponsored by:	Packet Forensics
2010-03-05 22:46:11 +00:00
Warner Losh
a62e05a4e0 Make printfs work for both OCTEON1 and OCTEON1-32 2010-02-18 19:27:00 +00:00
Oleksandr Tymoshenko
f6951d3084 - Clean-up output of memory banks info 2010-02-16 00:08:42 +00:00
Warner Losh
dd8b9d6300 We make it to single user well, but not so well to multi-user. Force
single user for the moment since that's a better experience for people
trying this code out...
2010-01-28 20:39:50 +00:00
Warner Losh
3dae97d413 Doh. Remove extra pcpu initialization that I thought was needed, but
isn't needed since we moved all that into mips_pcpu0_init.
2010-01-26 02:39:14 +00:00
Warner Losh
e7f82fbbaf o Write the soft reset bit in the cavium core to reset. [1]
o panic if the board boot descriptor is too old...

Obtained from:	[1] looking at the cavium sdk's executive code
2010-01-24 18:05:38 +00:00
Warner Losh
2069a5911e Eliminate octeonregs.h. It was a copy of maltaregs.h with
s/malta/octeon/gi done...
2010-01-23 06:42:47 +00:00
Warner Losh
8c019fbaa9 Migrate from old "DDB" style debugger to newer KDB style. 2010-01-23 00:24:31 +00:00
Warner Losh
f92a1e9b89 o Add support for memory above 256MB on the octeon.
o Force the ebase to be 0x80000000 (the base that we're booted with may
  need to be respected in the future).
o Initialize the clock early so we can initialize the console early
o use panic where we can now use it.
o Tag some code for parsing the boot records as belonging in the cavium sdk.
o remove support for booting on ancient boards...

# we make it further in bootstrapping now: interrupts being enabled in the
# uarts are now taking us out, it seems, for reasons unknown.
2010-01-22 20:40:07 +00:00
Warner Losh
5f04b82bcc Don't clear bss/sbss. The boot loader already does this. In addition,
the Cavium version of the boot loader puts data just after &end, so
our rounding up to the next page in clearing memory overwrote their
data, which meant we'd get a lot of wrong values for parameters to the
system.

While I'm here, remove argc/argv parsing.  Those values aren't passed
in via a0 and a1, so it was a guaranted panic on some boards.
2010-01-22 09:23:34 +00:00
Warner Losh
24e4f4a84d Jump to the mips reset vector. OR in the 0x80000000 for kseg0 and
cast it to a long so it will work on 64-bit targets.

reset now works on octeon, so I don't have to power cycle the board as
often.
2010-01-22 09:19:57 +00:00
Warner Losh
a6ec986223 Cope with the move and if_timer going way. 2010-01-11 04:29:26 +00:00
Warner Losh
6b06709221 Merge from projects/mips to head by hand:
Copy the support files for the Octeon 1 CPU from sys/mips/octeon1 on
the projects/mips side to sys/mips/cavium on the head side to conform
to the other vendor code.  This code was contributed by Cavium to the
project and forward ported by Warner Losh, with some additional code
from Randal Stewart.

# I'll fix the building problems the move creates in a future commit.
2010-01-09 18:59:03 +00:00