Commit Graph

200034 Commits

Author SHA1 Message Date
Ian Lepore
16bf8dd6dc Don't check the return value from self_reloc(), it can't fail and doesn't
return a value.

Despite what I said in my prior commit, it turns out this one platform
was checking the return value from the old self-reloc code (which returned
a hard-coded 0).
2015-05-10 13:30:21 +00:00
Ian Lepore
5b1c03fd13 The self-relocation code is not efi-specific, move it to boot/common.
The function was defined as taking 4 parameters and returning EFI_STATUS,
but all existing callers (in asm code) passed only two parameters and don't
use the return value. The function signature now matches that usage, and
doesn't refer to efi-specific types.

Parameters and variables now use the cannonical typenames set up by elf.h
(Elf_Word, Elf_Addr, etc) instead of raw C types. Hopefully this will
prevent suprises as new platforms come along and use this code.

The function was renamed from _reloc() to self_reloc() to emphasize its
difference from the other elf relocation code found in boot/common.

Differential Revision:	https://reviews.freebsd.org/D2490
2015-05-10 13:24:26 +00:00
Thomas Quinot
9d8b66868a Ensure libmd symbols do not clash with libcrypto
Add a prefix to all symbols in libmd to avoid incompatibilites
with same-named, but not binary compatible, symbols from libcrypto.

Also introduce Weak aliases to avoid the need to rebuild dependent
binaries and a major version bump.

PR:		199119
Differential Revision:	D2216
Reviewed by:	roberto, delphij
MFC after:	2 weeks
2015-05-10 13:21:36 +00:00
Hans Petter Selasky
a998d1031c Put recycle pointer in own memory area which is not mmap'able. 2015-05-10 12:45:21 +00:00
Andrew Turner
ace157c3a9 Use the new gic option on all configs that need it. 2015-05-10 12:13:27 +00:00
Baptiste Daroussin
7bc60a1616 For half and reverse line feeds, recognize both SUSv2-style escape-digit
and BSD-style escape-control-char sequences in the input stream.

Submitted by:	schwarze at OpenBSD
Discussed with:	schwarze at OpenBSD
Obtained from:	OpenBSD
2015-05-10 11:41:38 +00:00
Baptiste Daroussin
234626f722 Remove extendline definition
Remove now unused PWBUFSZ define
2015-05-10 11:24:16 +00:00
Baptiste Daroussin
a1d3bf2e8f Use calloc(3) instead of malloc(3) + memset(3)
While here check the return of calloc(3)
2015-05-10 11:18:01 +00:00
Baptiste Daroussin
36dc2e6885 The initial logic for allocating the new string was wrong, the conversion
to strndup(3) duplicated the same mistake, actually strdup(3) is good enough
to allocate the new string.
2015-05-10 10:15:36 +00:00
Baptiste Daroussin
a84caa72b0 Use strndup(3) instead of malloc(3) + memcpy(3)
Check the return of strndup
2015-05-10 10:02:09 +00:00
Andrew Turner
1486e4bb63 Use the new gic option. While here remove extra whitespace from the ned of
a few lines.
2015-05-10 09:37:54 +00:00
Baptiste Daroussin
2c3065da9c Remove useless call to extendarray 2015-05-10 09:33:15 +00:00
Andrew Turner
e4ca149905 Add the gic to files.arm under "device gic" and use it with the
CUBIEBOARD2 config. This is common across a few SoCs so should be a common
option.
2015-05-10 09:33:03 +00:00
Andrew Turner
5357ace59e First pass clenup over the Marvell db-88f6xxx kernel configs. 2015-05-10 09:23:49 +00:00
Baptiste Daroussin
35ddfb6d6c The pwdb function is only used once to check the database rename it
pwdb_check and simplify it accordingly
2015-05-10 09:23:03 +00:00
Baptiste Daroussin
b1a215787d if the check of the pw db fails return the failed value 2015-05-10 09:11:12 +00:00
Konstantin Belousov
f116422f38 Initialize pcids array for the proc0 pmap.
Sponsored by:	The FreeBSD Foundation
MFC after:	3 weeks
2015-05-10 09:09:07 +00:00
Konstantin Belousov
78ac908e9b Tweak assert to also print the thread address.
Sponsored by:	The FreeBSD Foundation
MFC after:	3 weeks
2015-05-10 09:05:57 +00:00
Baptiste Daroussin
ee348c32ad Some style(9) fixes 2015-05-10 09:02:15 +00:00
Konstantin Belousov
7b445033ff On exec, single-threading must be enforced before arguments space is
allocated from exec_map.  If many threads try to perform execve(2) in
parallel, the exec map is exhausted and some threads sleep
uninterruptible waiting for the map space.  Then, the thread which won
the race for the space allocation, cannot single-thread the process,
causing deadlock.

Reported and tested by:	pho (previous version)
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
2015-05-10 09:00:40 +00:00
Andrew Turner
70ad407c86 Clean up the style to use "options<space><tab>". 2015-05-10 08:48:00 +00:00
Konstantin Belousov
9cddade79a Satisfy vm_object uma zone destructor requirements after r282660 when
vnode object creation raced.

Reported by:	pho
Reviewed by:	alc
Sponsored by:	The FreeBSD Foundation
2015-05-10 08:21:03 +00:00
Adrian Chadd
bfca9c9400 Turn ieee80211_start_scan_locked() into a swscan module private method.
It turns out that ieee80211_start_scan_locked() is only ever called by
the swscan code and it won't likely be required by firmware scanning
implementations.

So, don't bother keeping it in ieee80211_scan.c and it likely won't
become an API call.

Tested:

* Intel 5100, STA mode
* AR5416, STA mode
2015-05-10 06:59:34 +00:00
Adrian Chadd
3265af355a Attempt to address Bug #176201 - don't advertise what the AP announced
to us. Instead, advertise what we can do based on what the AP says and what
we're capped at by the VAP settings.

For non-STA modes we still advertise what our VAP settings are.

It may be that I've over-complicated this and instead of capping things
we can just always announce what we're capable of.  But this should at least
stop the blatantly wrong handling of A-MPDU parameters.

(I'll happily simplify things if someone can dig up a replacement, better
compliant behaviour.)

PR:		kern/176201
2015-05-10 06:57:53 +00:00
Justin Hibbits
45bf6d59de Fix a couple bugs in 64-bit powerpc fasttrap argument retrieval.
Found by code inspection.
2015-05-10 04:33:01 +00:00
Luiz Otavio O Souza
1b53f6c5a3 Remove unnecessary code and make use of generic implementations for
bus_alloc_resource(), bus_release_resource() and bus_set_resource()
(bus_generic_rl_alloc_resource(), bus_generic_rl_release_resource() and
bus_generic_rl_set_resource() respectively).

Do not print the resources for nomatch devices.

Use the inherited method for bus_get_resource_list() on ofw_iicbus.c.

Submitted by:	jhb and Michal Meloun (D2033)
2015-05-10 02:19:27 +00:00
Baptiste Daroussin
2518db8bb0 Replace sprintf(3) with snprintf(3) 2015-05-09 22:48:48 +00:00
Baptiste Daroussin
5d8ece9a4b Use snprintf(3) instead of sprintf(3)
Remove useless "else"
2015-05-09 22:43:44 +00:00
Baptiste Daroussin
8592cfc58e Remove now unused LNBUFSZ buffer size 2015-05-09 22:08:30 +00:00
Baptiste Daroussin
5963cf64b5 Return from the function as early as possible
This reduces the depth of the if statements and improves clarity of the code
2015-05-09 21:53:33 +00:00
Konstantin Belousov
b40a715c11 Correct the assertion. We should compare the pmap' curcpu pcid value
against 0, not the pmap.

Noted by:	Oliver Pinter <oliver.pinter@hardenedbsd.org>
Sponsored by:	The FreeBSD Foundation
MFC after:	3 weeks
2015-05-09 21:36:44 +00:00
Andrew Turner
532248e092 Pass over the at91 kernels to reduce the diff between them. 2015-05-09 21:24:55 +00:00
Glen Barber
88feae84be Merge ^/projects/release-arm-redux into ^/head.
Of note:

- This commit adds native FreeBSD/arm release build support without
  requiring out-of-tree utilities.

- Part of this merge removes the WANDBOARD-{SOLO,DUAL,QUAD} kernel
  configuration files, for which the IMX6 kernel configuration file
  should be used instead.

- The resulting images have a 'freebsd' user (password 'freebsd'),
  to allow ssh(1) access when console access is not available (VGA
  or serial).  The default 'root' user password is set to 'root'.

- The /etc/ttys file for arm images now enable both ttyv0 and ttyu0
  by default.

Help from:	many (boot testing, feedback, etc.)
Sponsored by:	The FreeBSD Foundation
2015-05-09 21:08:12 +00:00
Konstantin Belousov
44ec2b63c5 The vmem callback to reclaim kmem arena address space on low or
fragmented conditions currently just wakes up the pagedaemon.  The
kmem arena is significantly smaller then the total available physical
memory, which means that there are loads where kmem arena space could
be exhausted, while there is a lot of pages available still.  The
woken up pagedaemon sees vm_pages_needed != 0, verifies the condition
vm_paging_needed() which is false, clears the pass and returns back to
sleep, not calling neither uma_reclaim() nor lowmem handler.

To handle low kmem arena conditions, create additional pagedaemon
thread which calls uma_reclaim() directly.  The thread sleeps on the
dedicated channel and kmem_reclaim() wakes the thread in addition to
the pagedaemon.

Reported and tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
2015-05-09 20:08:36 +00:00
Baptiste Daroussin
4bc8ff0802 Remove some uneeded headers 2015-05-09 19:29:55 +00:00
Baptiste Daroussin
ce82bf7261 Remove unneeded headers 2015-05-09 19:22:33 +00:00
Baptiste Daroussin
b2298745ac Replace malloc(3) + strcpy(3) + strcat(3) by asprintf(3) 2015-05-09 19:12:16 +00:00
Konstantin Belousov
a546448b8d Rewrite amd64 PCID implementation to follow an algorithm described in
the Vahalia' "Unix Internals" section 15.12 "Other TLB Consistency
Algorithms".  The same algorithm is already utilized by the MIPS pmap
to handle ASIDs.

The PCID for the address space is now allocated per-cpu during context
switch to the thread using pmap, when no PCID on the cpu was ever
allocated, or the current PCID is invalidated.  If the PCID is reused,
bit 63 of %cr3 can be set to avoid TLB flush.

Each cpu has PCID' algorithm generation count, which is saved in the
pmap pcpu block when pcpu PCID is allocated.  On invalidation, the
pmap generation count is zeroed, which signals the context switch code
that already allocated PCID is no longer valid.  The implication is
the TLB shootdown for the given cpu/address space, due to the
allocation of new PCID.

The pm_save mask is no longer has to be tracked, which (significantly)
reduces the targets of the TLB shootdown IPIs.  Previously, pm_save
was reset only on pmap_invalidate_all(), which made it accumulate the
cpuids of all processors on which the thread was scheduled between
full TLB shootdowns.

Besides reducing the amount of TLB shootdowns and removing atomics to
update pm_saves in the context switch code, the algorithm is much
simpler than the maintanence of pm_save and selection of the right
address space in the shootdown IPI handler.

Reviewed by:	alc
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	3 weeks
2015-05-09 19:11:01 +00:00
Baptiste Daroussin
0602630cc7 Use snprintf(3) instead of strcpy(3) + strncat(3) 2015-05-09 19:09:34 +00:00
Baptiste Daroussin
a8e37ee0ac Use sbuf(9) instead of homebrewed buffered string 2015-05-09 19:00:16 +00:00
Konstantin Belousov
6841f70168 Remove unused define.
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2015-05-09 18:38:35 +00:00
Konstantin Belousov
ac437c0754 Do not return from thread_single(SINGLE_BOUNDARY) until all stopped
thread are guarenteed to be removed from the processors.

Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2015-05-09 18:32:13 +00:00
Konstantin Belousov
b57a73f8e7 If x86 CPU implementation of the MWAIT instruction reasonably
interacts with interrupts, query ACPI and use MWAIT for entrance into
Cx sleep states.  Support C1 "I/O then halt" mode.  See Intel'
document 302223-007 "Intelб╝ Processor Vendor-Specific ACPI Interface
Specification" for description.

Move the acpi_cpu_c1() function into x86/cpu_machdep.c and use
it instead of inlining "sti; hlt" sequence in several places.

In the acpi(4) man page, besides documenting the dev.cpu.N.cx_methods
sysctl, correct the names for dev.cpu.N.{cx_usage,cx_lowest,cx_supported}
sysctls.

Both jkim and avg have some other patches implementing the mwait
functionality; this work is unrelated.  Linux does not rely on the
ACPI to provide correct tables describing Cx modes.  Instead, the
driver has pre-defined knowledge of the CPU models, it was supplied by
Intel.

Tested by:    pho (previous versions)
Sponsored by:	The FreeBSD Foundation
2015-05-09 12:28:48 +00:00
Bjoern A. Zeeb
62699f3424 Convert remaining hwpmc(4) debug printfs over to KTR to unbreak the build
for at least powerpc kernels.   Missed in r282658.

MFC after:	10 days
2015-05-09 09:21:59 +00:00
Luiz Otavio O Souza
8b651535df Pass the resources requests to the upper bus.
Submitted by:	Michal Meloun <meloun@miracle.cz>
2015-05-09 03:39:18 +00:00
Luiz Otavio O Souza
3bb6bf473f Handle IRQ resources on iicbus and ofw_iicbus.
Based on a patch submitted by Michal Meloun <meloun@miracle.cz>.
2015-05-09 03:05:44 +00:00
Stanislav Sedov
dc599a6bd9 Fix the double space in comment.
While here, change the comment style to match the rest of the file.
2015-05-09 00:48:44 +00:00
Xin LI
2547b459b0 Always convert uuid to lower case.
MFC after:	2 weeks
2015-05-08 23:36:31 +00:00
Baptiste Daroussin
f23ed79b08 Fix about ten integer overflows and underflows and a handful of logic
errors in line number handling.

Submitted by:	ingo at OpenBSD
Discussed with:	ingo at OpenBSD
Obtained from:	OpenBSD
2015-05-08 22:11:54 +00:00
Luiz Otavio O Souza
5791e134f7 Replace spaces with tabs, removes an extra blank line.
No functional changes.
2015-05-08 21:51:37 +00:00