Commit Graph

922 Commits

Author SHA1 Message Date
Juli Mallett
529fb1406b o) Remove some unused local definitions of IP protocol numbers.
o) Use CPU_FOREACH rather than a miscrafted for loop with an off-by-one to
   enable workq interrupts on all cores.
2011-01-09 23:05:46 +00:00
Konstantin Belousov
50a57dfbec Move repeated MAXSLP definition from machine/vmparam.h to sys/vmmeter.h.
Update the outdated comments describing MAXSLP and the process
selection algorithm for swap out.

Comments wording and reviewed by:	alc
2011-01-09 12:50:44 +00:00
Adrian Chadd
8779d9c963 Add missing ar91xx definition for the WMAC reset control. 2011-01-09 06:17:46 +00:00
Tijl Coosemans
f65742b27b White space changes to align comments. The mips and powerpc _inttypes.h
are now exactly the same.

Approved by:	kib (mentor)
2011-01-08 18:02:46 +00:00
Tijl Coosemans
9821039a64 Rename PRIreg helper macro to PRIptr to better reflect its use. Registers
and pointers don't always have the same size, e.g. the __mips_n32 ABI
(ILP32) has 64 bit registers but 32 bit pointers.

On mips introduce PRIptr to fix the format specifier for (u)intptr_t.

Prefix PRI64 and PRIptr with underscores because macro names starting with
PRI[a-zX] are reserved for future use.

Approved by:	kib (mentor)
2011-01-08 18:00:19 +00:00
Tijl Coosemans
a56e818f29 On mixed 32/64 bit architectures (mips, powerpc) use __LP64__ rather than
architecture macros (__mips_n64, __powerpc64__) when 64 bit types (and
corresponding macros) are different from 32 bit. [1]

Correct the type of INT64_MIN, INT64_MAX and UINT64_MAX.

Define (U)INTMAX_C as an alias for (U)INT64_C matching the type definition
for (u)intmax_t. Do this on all architectures for consistency.

Suggested by:	bde [1]
Approved by:	kib (mentor)
2011-01-08 12:43:05 +00:00
Tijl Coosemans
d942996baf On 32 bit architectures define (u)int64_t as (unsigned) long long instead
of (unsigned) int __attribute__((__mode__(__DI__))). This aligns better
with macros such as (U)INT64_C, (U)INT64_MAX, etc. which assume (u)int64_t
has type (unsigned) long long.

The mode attribute was used because long long wasn't standardised until
C99. Nowadays compilers should support long long and use of the mode
attribute is discouraged according to GCC Internals documentation.

The type definition has to be marked with __extension__ to support
compilation with "-std=c89 -pedantic".

Discussed with:	bde
Approved by:	kib (mentor)
2011-01-08 11:47:55 +00:00
Tijl Coosemans
9858863cd4 Fix types of some values in machine/_limits.h.
On some architectures UCHAR_MAX and USHRT_MAX had type unsigned int.
However, lacking integer suffixes for types smaller than int, their type
should correspond to that of an object of type unsigned char (or short)
when used in an expression with objects of type int. In that case unsigned
char (short) are promoted to int (i.e. signed) so the type of UCHAR_MAX and
USHRT_MAX should also be int.

Where MIN/MAX constants implicitly have the correct type the suffix has
been removed.

While here, correct some comments.

Reviewed by:	bde
Approved by:	kib (mentor)
2011-01-08 11:13:34 +00:00
Tijl Coosemans
911127a0d6 Remove unused support for 64 bit long on 32 bit architectures.
It was used mainly to discover and fix some 64-bit portability problems
before 64-bit arches were widely available.

Discussed with:	bde
Approved by:	kib (mentor)
2011-01-07 22:57:31 +00:00
Konstantin Belousov
39198f15ee Add AT_STACKPROT elf aux vector. Will be used to inform rtld about the
initial stack protection set by the kernel image activator.
2011-01-07 14:22:34 +00:00
John Baldwin
c305730dc0 Remove bogus usage of INTR_FAST. "Fast" interrupts are now indicated by
registering a filter handler rather than a threaded handler.  Also remove
a bogus use of INTR_MPSAFE for a filter.
2011-01-06 21:08:06 +00:00
Juli Mallett
ab19dbcf8d Correct an 8-year-old typo which reliably leads to typo after typo today:
The macros here for generating coprocessor 0 accessors are named like:

	MIPS_RDRW32_COP0

That macro would produce mips_rd_<register>() and mips_wr_<register>()
inlines to access the specified register by name from C.  The problem is that
the R and the W were swapped in the macros originally; it was meant to be named
RDWR because it generated mips_rd_* and mips_wr_* functions, but was instead
spelled RDRW, which nobody should be expected to get right by anything other
than copy and paste.

It's too many consonants in a row to keep straight anyway, so just prefer e.g.:

	MIPS_RW32_COP0

While here, add a missing #undef.
2011-01-04 19:32:03 +00:00
Juli Mallett
9a264080b5 Remove OCTEON1-32. Since moving to the Cavium SDK, we've lost our support for
running an o32 kernel safely, and would have to add interrupt disabling and
reenabling to a bunch of macros in the Simple Executive sources to support it.

The only reason one would run an o32 kernel on Octeon would be to run o32 world,
which is better worked towards by adding o32 binary compatibility to n64 kernels
along with, eventually, supporting multilib systems so o32 binaries can run
alongside n32 and n64 ones.

Discussed with:	imp
2011-01-04 19:09:05 +00:00
Juli Mallett
7b62328843 o) Add MIPS_COP_0_EXC_PC accessors to <machine/cpufunc.h>.
o) Make the octeon_wdog driver work on multi-CPU systems and to also print more
   information on NMI that may aid debugging.  Simplify and clean up internal
   API and structure.
2011-01-04 02:33:48 +00:00
Juli Mallett
5308af6337 o) Unmask Central Interrupt Unit interrupts on APs, too.
o) There's no good reason to make the low bits of the ebase the core
   number.  While per-CPU exception bases would be nice, for now we just
   need to make ebase the same on all cores.
2011-01-04 02:11:03 +00:00
Juli Mallett
5610751bf1 o) When trying to determine whether the pcpu pointer is a managed address, check
not just that it is greater than the minimal kernel virtual address, but also
   that it is less than the maximal kernel virtual address.  On n64 kernels, the
   pcpup comes out of a direct-mapped address that, with an unsigned compare, is
   rather greater than the minimal kernel virtual address.
o) Turn the panic if interrupts are disabled in cpu_idle into a KASSERT since on
   other architectures it's behind INVARIANTS anyway.
o) Add a check that not all interrupts are masked, too.
o) Add cpu_idleclock() and cpu_activeclock() use to cpu_idle as is done on other
   architectures.
2011-01-01 00:20:14 +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
Nathan Whitehorn
886a0c5b95 Include std.sentry5 from the SENTRY5 kernel configuration. This was
apparently missed in r215270.
2010-12-22 19:01:48 +00:00
Juli Mallett
4a7b75273b o) Add support for the Lanner MR-321X/MR-325, which is just a modified MR-320.
o) On the Lanner MR-730, disable PCIe lane swap, per vendor.
2010-12-16 07:20:38 +00:00
Oleksandr Tymoshenko
3693ce5732 - include argument should be in quotes 2010-12-16 05:13:41 +00:00
Jayachandran C.
d048eaaca7 Make the ELF trampoline binary ELF executable (and do some cleanup).
- Remove the -shared flag for the trampoline binary, generate an
  ELF executable instead of a shared object.
- No need to generate tmphack.S,  move the code to sys/mips/mips/inckern.S
- No need generate opt_kernname.h, KERNNAME can be passed with -D

Reviewed by:	gonzo, imp
2010-12-16 04:56:03 +00:00
Jayachandran C.
d0beb2c412 Updates for I2C devices on XLR engg boards.
- ds1374u : use multi-byte write.
- at24co2n, max6657: remove mutex, iicbus has the necessary locking.

Submitted by:	Sreekanth M. S. (kanthms at netlogicmicro com)
2010-12-13 17:53:38 +00:00
Andriy Gapon
bc8022ea4a fix mips build breakage introduced in r216375: atomic_store_int doesn't exists
1) 32-bit assignment are expected to always be atomic.
2) Release/acquire memory barrier semantics doesn't seem to be needed here.
So a simple assignment can be used.

Remove unused port_set_counter() while here, it also used to mis-use
atomic_set_int().

Reported by:	jhb
Pointyhat to:	avg
MFC after:	3 weeks
2010-12-13 14:30:35 +00:00
Jayachandran C.
3ba09158c8 I2C drivers for XLR/XLS processors.
- Major update to xlr_i2c.c: do multi-byte ops correctly, remove unnecessary
  code, add mutex to protect bus operations, style(9) fixes.
- Drivers for I2C devices on XLR/XLS engineering boards, ds1374u RTC, max6657
  temparature sensor and at24co2n EEPROM.

Submitted by:	Sreekanth M. S. (kanthms at netlogicmicro com)
2010-12-12 06:00:26 +00:00
Andriy Gapon
4fa9db8da0 fix atomic_set_xxx misuse in rge
It seems that atomic_set_xxx and atomic_store_xxx were confused.

Reviewed by:	jhb (general issue)
MFC after:	3 weeks
2010-12-11 10:21:38 +00:00
Jayachandran C.
96417c3f8c Fix compilation when DEBUG option is enabled.
- remove unused code in mips/rmi/xlr_pci.c
- remove unused variable in mips/rmi/dev/nlge/if_nlge.c
- fix reference to old function in mips/mips/pmap.c

Reported by:	Prabhath Raman (prabhath at netlogicmicro com)
2010-12-09 12:30:13 +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
Jayachandran C.
aa93efedd8 swi_vm() for mips. 2010-12-09 06:54:06 +00:00
Jayachandran C.
6264198089 UMA_MD_SMALL_ALLOC for mips.
Implement uma_small_alloc() and uma_small_free() for mips that allocates
pages from direct mapped memory. Uses the same mechanism as the page table
page allocator, so that we allocate from KSEG0 in 32 bit, and from XKPHYS
on 64 bit.

Reviewed by:	alc, jmallett
2010-12-09 06:34:28 +00:00
Kevin Lo
7df9d5acad Fix double ;; 2010-12-06 10:24:06 +00:00
Jayachandran C.
63ae6e6018 1. Fix off by one errors in calls to MIPS_DIRECT_MAPPABLE, reported by alc@
2. Remove unnecessary #defines from vmparam.h

Submitted by:	alc (2)
Reviewed by:	alc (1)
2010-12-03 19:22:18 +00:00
Jayachandran C.
42b73858e9 Fixup for r216141, dump_add_page needs to be non-static now.
Add it to sys/mips/include/md_var.h, make dump_drop_page non-static too
for completeness.
2010-12-03 14:20:20 +00:00
Rebecca Cran
c90f7d9b44 Revert r216134. This checkin broke platforms where bus_space are macros:
they need to be a single statement, and do { } while (0) doesn't work in this
situation so revert until a solution can be devised.
2010-12-03 07:09:23 +00:00
Rebecca Cran
15b4888a24 Disallow passing in a count of zero bytes to the bus_space(9) functions.
Passing a count of zero on i386 and amd64 for [I386|AMD64]_BUS_SPACE_MEM
causes a crash/hang since the 'loop' instruction decrements the counter
before checking if it's zero.

PR:	kern/80980
Discussed with:	jhb
2010-12-02 22:19:30 +00:00
Juli Mallett
648260edcc Add interrupt describing and binding to CIU. 2010-12-01 05:24:29 +00:00
Juli Mallett
074a0a8d57 Run all poll requests through a single function that can either do the generic
link state polling or media-specific ones, while avoidiing changing link state
on interfaces that use miibus; this substantially speeds up link time on
interface (re)initialization.
2010-11-30 07:14:05 +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
b8248487b3 Don't free the work queue entry that we're using to hold the scatter-gather
list on exit from the transmit path.  The scatter-gather list itself can be
asynchronously DMAed to the transmit hardware, and we could actually lock up
the transmitter if any of a number of races around this were lost.

Instead, let the PKO free the scatter-gather list when it is done with it, and
use the "i" bit in each segment of the packet to avoid having them go into the
FPA.

This fixes an unrecoverable transmit stall under transmit load.

MFC after:	3 days
2010-11-29 21:04:00 +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
Oleksandr Tymoshenko
006d0f38be - Add watchdog driver for Cavium Octeon. At the moment only
UP systems are supported.
2010-11-28 08:11:05 +00:00
Juli Mallett
34e3f53b7c o) Remove some commented out or unimplemented code.
o) Remove some options that are configurable on Linux but not FreeBSD.
o) Centralize open/poll/stop routines for XAUI and SGMII and use the common
   uninit routine directly rather than providing a wrapper for it.  The init
   functions for these interfaces are now identical and the common init routine
   could merge in setting those function pointers except that some hardware
   seems to use no open/poll/stop method?
2010-11-28 05:57:24 +00:00
Jayachandran C.
aa54636620 Fix issue noted by alc while reviewing r215938:
The current implementation of vm_page_alloc_freelist() does not handle
order > 0 correctly. Remove order parameter to the function and use it
only for order 0 pages.

Submitted by:	alc
2010-11-28 05:51:31 +00:00
Juli Mallett
2a89829bde Set MACHINE_ARCH based on ABI and endianness.
Reviewed by:	imp
2010-11-28 04:07:45 +00:00
Juli Mallett
ed11b5abe1 Remove unused and broken code to implement POW send and POW-only devices; a
separate POW driver makes more sense, generally.
2010-11-28 00:26:08 +00:00
Juli Mallett
25b0900026 Use if_transmit to avoid ifq locking in transmit path. 2010-11-27 22:42:41 +00:00
Jayachandran C.
1e8b029539 Use if_transmit method instead of if_start, this avoids the interface queue lock.
Use the hardware IP checksum verification on receive.

Submitted by:	Sriram Gorti (srgorti at netlogicmicro dot com)
2010-11-27 13:35:19 +00:00
Dimitry Andric
3e288e6238 After some off-list discussion, revert a number of changes to the
DPCPU_DEFINE and VNET_DEFINE macros, as these cause problems for various
people working on the affected files.  A better long-term solution is
still being considered.  This reversal may give some modules empty
set_pcpu or set_vnet sections, but these are harmless.

Changes reverted:

------------------------------------------------------------------------
r215318 | dim | 2010-11-14 21:40:55 +0100 (Sun, 14 Nov 2010) | 4 lines

Instead of unconditionally emitting .globl's for the __start_set_xxx and
__stop_set_xxx symbols, only emit them when the set_vnet or set_pcpu
sections are actually defined.

------------------------------------------------------------------------
r215317 | dim | 2010-11-14 21:38:11 +0100 (Sun, 14 Nov 2010) | 3 lines

Apply the STATIC_VNET_DEFINE and STATIC_DPCPU_DEFINE macros throughout
the tree.

------------------------------------------------------------------------
r215316 | dim | 2010-11-14 21:23:02 +0100 (Sun, 14 Nov 2010) | 2 lines

Add macros to define static instances of VNET_DEFINE and DPCPU_DEFINE.
2010-11-22 19:32:54 +00:00
Dimitry Andric
31c6a0037e Apply the STATIC_VNET_DEFINE and STATIC_DPCPU_DEFINE macros throughout
the tree.
2010-11-14 20:38:11 +00:00
Warner Losh
161b83b959 Remove the 'machine mips' from DEFAULTS. Put the proper 'machine mips
mipsel' or 'machine mips mipseb' into the config file (with a few 64's
tossed in for good measure).  This will let us build the proper
kernels with different worlds as part of make universe.
2010-11-13 22:34:12 +00:00