freebsd.git
8 years agoCorrectly update the address to write to after storing the stack pointer
andrew [Tue, 25 Aug 2015 16:43:32 +0000 (16:43 +0000)]
Correctly update the address to write to after storing the stack pointer
in the kernels setjmp function.

Sponsored by: ABT Systems Ltd

8 years agoCode cleanup unused-but-set-variable spotted by gcc.
araujo [Tue, 25 Aug 2015 15:34:28 +0000 (15:34 +0000)]
Code cleanup unused-but-set-variable spotted by gcc.

Reviewed by: royger
Approved by: bapt (mentor)
Differential Revision: D3476

8 years agoCode cleanup unused-but-set-variable spotted by gcc.
araujo [Tue, 25 Aug 2015 15:33:09 +0000 (15:33 +0000)]
Code cleanup unused-but-set-variable spotted by gcc.

Approved by: bapt (mentor)
Differential Revision: D3475

8 years agoCode cleanup unused-but-set-variable spotted by gcc.
araujo [Tue, 25 Aug 2015 15:32:08 +0000 (15:32 +0000)]
Code cleanup unused-but-set-variable spotted by gcc.

Reviewed by: melifaro
Approved by: bapt (mentor)
Differential Revision: D3473

8 years agoSync ypwhich(1) code with the OpenBSD version that is more modern.
araujo [Tue, 25 Aug 2015 15:27:32 +0000 (15:27 +0000)]
Sync ypwhich(1) code with the OpenBSD version that is more modern.
Update the BSD LICENSE and remove the 3rd clause.

Reviewed by: rodrigc, kib, bapt
Approved by: bapt (mentor)
Obtained from: OpenBSD
Differential Revision: D3249

8 years agoLeave hypervisor mode upon startup on ARMv7
zbb [Tue, 25 Aug 2015 14:49:11 +0000 (14:49 +0000)]
Leave hypervisor mode upon startup on ARMv7

If ARMv7 boots in HYP mode, switch to SVC32.

Reviewed by:   ian
Submitted by:  Wojciech Macek <wma@semihalf.com>
               Jakub Palider  <jpa@semihalf.com>
Obtained from: Semihalf
Sponsored by:  Annapurna Labs
Differential Revision: https://reviews.freebsd.org/D1810

8 years agoMake UTF-8 parsing and generation more strict.
ed [Tue, 25 Aug 2015 09:16:09 +0000 (09:16 +0000)]
Make UTF-8 parsing and generation more strict.

- in mbrtowc() we need to disallow codepoints above 0x10ffff.
- In wcrtomb() we need to disallow codepoints between 0xd800 and 0xdfff.

Reviewed by: bapt
Differential Revision: https://reviews.freebsd.org/D3399

8 years agoCall the new RSS hash calculation function to correctly calculate a hash
adrian [Tue, 25 Aug 2015 06:12:59 +0000 (06:12 +0000)]
Call the new RSS hash calculation function to correctly calculate a hash
based on the configured requirements for the protocol.

Tested:

* UDP IPv6 TX/RX testing, w/ RSS enabled, 82599 ixgbe(4) hardware

8 years agoFinish r89633 and completely remove the remaining of VERSION.
delphij [Tue, 25 Aug 2015 05:31:00 +0000 (05:31 +0000)]
Finish r89633 and completely remove the remaining of VERSION.

PR: bin/202308
Submitted by: John Hein <z7dr6ut7gs snkmail com>
MFC after: 2 weeks

8 years agoTesting whether a page is dirty does not require the page lock. Moreover,
alc [Tue, 25 Aug 2015 01:01:25 +0000 (01:01 +0000)]
Testing whether a page is dirty does not require the page lock.  Moreover,
it may involve a pmap operation that iterates over the page's PV list, so
unnecessarily holding the page lock is undesirable.

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division

8 years agoFix the spelling of eri's name.
loos [Mon, 24 Aug 2015 23:40:36 +0000 (23:40 +0000)]
Fix the spelling of eri's name.

Pointy hat to: loos
MFC with: r287009

8 years agoReapply r196551 which was accidentally reverted by r223637 (update to
loos [Mon, 24 Aug 2015 21:41:05 +0000 (21:41 +0000)]
Reapply r196551 which was accidentally reverted by r223637 (update to
OpenBSD pf 4.5).

Fix argument ordering to memcpy as well as the size of the copy in the
(theoretical) case that pfi_buffer_cnt should be greater than ~_max.

This fix the failure when you hit the self table size and force it to be
resized.

MFC after: 3 days
Sponsored by: Rubicon Communications (Netgate)

8 years agoioatcontrol(8): Fix build
cem [Mon, 24 Aug 2015 20:39:22 +0000 (20:39 +0000)]
ioatcontrol(8): Fix build

Tripped up by the FBSD SVN pre-commit hook!

Approved by: markj (mentor)
Sponsored by: EMC / Isilon Storage Division

8 years agoImport ioat(4) driver
cem [Mon, 24 Aug 2015 19:32:03 +0000 (19:32 +0000)]
Import ioat(4) driver

I/OAT is also referred to as Crystal Beach DMA and is a Platform Storage
Extension (PSE) on some Intel server platforms.

This driver currently supports DMA descriptors only and is part of a
larger effort to upstream an interconnect between multiple systems using
the Non-Transparent Bridge (NTB) PSE.

For now, this driver is only built on AMD64 platforms.  It may be ported
to work on i386 later, if that is desired.  The hardware is exclusive to
x86.

Further documentation on ioat(4), including API documentation and usage,
can be found in the new manual page.

Bring in a test tool, ioatcontrol(8), in tools/tools/ioat.  The test
tool is not hooked up to the build and is not intended for end users.

Submitted by: jimharris, Carl Delsey <carl.r.delsey@intel.com>
Reviewed by: jimharris (reviewed my changes)
Approved by: markj (mentor)
Relnotes: yes
Sponsored by: Intel
Sponsored by: EMC / Isilon Storage Division
Differential Revision: https://reviews.freebsd.org/D3456

8 years agoEnable hardfloat for assembly generation.
adrian [Mon, 24 Aug 2015 19:09:56 +0000 (19:09 +0000)]
Enable hardfloat for assembly generation.

gcc versions later than 4.2 started erroring out on seeing hardware
floating point references when soft-float was enabled.

Reviewed by: imp

8 years agoWhen forking a child process with PMC_F_DESCENDANTS set in pmc_attach()
bz [Mon, 24 Aug 2015 18:57:32 +0000 (18:57 +0000)]
When forking a child process with PMC_F_DESCENDANTS set in pmc_attach()
in the parent, we will inherit the pmcids but cannot execute any operations
on them in the child.  The reason for this is that pmc_find_pmc() only
tries to find the current process on the owners hash list, but given the
child does not own the attachment, we cannot find it.
Thus, in case the initial lookup fails, try to find the pmc_process state
affiliated with the child process, lookup the pmc from there using the
row index, and get the owner process from that pmc.
Then continue as normal and lookup the pmc context of the owner (process).

This allows us to call, e.g., pmc_start() in the child process before we
start the work there, but to collect the accumulated results later in
the parent.

Sponsored by: DARPA,AFRL
Obtained from: L41
Tested by: rwatson, L41
MFC after: 4 weeks
Reviewed by: gnn
Differential Revision: https://reviews.freebsd.org/D2052

8 years agoFix build for architectures that define wchar_t as an unsigned int.
marcel [Mon, 24 Aug 2015 17:58:11 +0000 (17:58 +0000)]
Fix build for architectures that define wchar_t as an unsigned int.

Reported by: bz@

8 years agoCheck the frame pointer is within the kernel before accessing it.
andrew [Mon, 24 Aug 2015 17:28:19 +0000 (17:28 +0000)]
Check the frame pointer is within the kernel before accessing it.

8 years agoStyle/whitespace cleanup in shared/common code.
sbruno [Mon, 24 Aug 2015 16:32:57 +0000 (16:32 +0000)]
Style/whitespace cleanup in shared/common code.

Differential Revision: https://reviews.freebsd.org/D3159
Submitted by: erj
MFC after: 2 weeks

8 years agoUpgrade libxo to 0.4.5.
marcel [Mon, 24 Aug 2015 16:26:20 +0000 (16:26 +0000)]
Upgrade libxo to 0.4.5.

Local changes incorporated by 0.4.5: r284340
Local changes retained: r276260, r282117

Obtained from: https://github.com/Juniper/libxo

8 years agoMake it possible to forcibly unmount devfs.
trasz [Mon, 24 Aug 2015 14:04:44 +0000 (14:04 +0000)]
Make it possible to forcibly unmount devfs.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

8 years agoRemove now unused LIBPRIVATEDIR
bapt [Mon, 24 Aug 2015 13:46:12 +0000 (13:46 +0000)]
Remove now unused LIBPRIVATEDIR

Sponsored by: Gandi.net

8 years agoMake vfs_unmountall() unmount /dev after /, not before. The only
trasz [Mon, 24 Aug 2015 13:18:13 +0000 (13:18 +0000)]
Make vfs_unmountall() unmount /dev after /, not before.  The only
reason this didn't result in an unclean shutdown is that devfs ignores
MNT_FORCE flag.

Reviewed by: kib@
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D3467

8 years agoFix libproc on architectures that don't need the program counter to be
andrew [Mon, 24 Aug 2015 12:17:15 +0000 (12:17 +0000)]
Fix libproc on architectures that don't need the program counter to be
adjusted. This seems to be the case on all non-x86 architectures libproc
supports.

Reviewed by: kib
Obtained from: ABT Systems Ltd
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D3465

8 years agoAdd support for pmap_sync_icache on arm64.
andrew [Mon, 24 Aug 2015 12:01:39 +0000 (12:01 +0000)]
Add support for pmap_sync_icache on arm64.

Reviewed by: emaste, imp (both earlier version)
Obtained from: ABT Systems Ltd
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D3438

8 years agoAdd pages used by the PV entries to minidumps.
andrew [Mon, 24 Aug 2015 10:55:54 +0000 (10:55 +0000)]
Add pages used by the PV entries to minidumps.

8 years agoMFV (partial) r286889: 5692 expose the number of hole blocks in a file
avg [Mon, 24 Aug 2015 09:48:50 +0000 (09:48 +0000)]
MFV (partial) r286889: 5692 expose the number of hole blocks in a file

FreeBSD porting notes:
- only kernel-side changes are merged
- the new ioctl is not actually implemented yet
- thus, the goal is to synchronize DMU code

illumos/illumos-gate@2bcf0248e992f292c7b814458bcdce2f004925d6

https://www.illumos.org/issues/5692
we would like to expose the number of hole (sparse) blocks in a file.
this can be useful to for example if you want to fill in the holes with
some data; knowing the number of holes in advances allows you to report
progress on hole filling. We could use SEEK_HOLE to do that but it would
be O(n) where n is the number of holes present in the file.

Author: Max Grossman <max.grossman@delphix.com>
Reviewed by: Adam Leventhal <ahl@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Boris Protopopov <bprotopopov@hotmail.com>
Approved by: Richard Lowe <richlowe@richlowe.net>

8 years agoSome random tweaks to ctl.conf(5).
trasz [Mon, 24 Aug 2015 09:33:12 +0000 (09:33 +0000)]
Some random tweaks to ctl.conf(5).

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

8 years agoRevert r284245: "Fix a callout race condition introduced in TCP
jch [Mon, 24 Aug 2015 09:30:27 +0000 (09:30 +0000)]
Revert r284245:  "Fix a callout race condition introduced in TCP
timers callouts with r281599."

r281599 fixed a TCP timer race condition, but due a callout(9) bug
it also introduced another race condition workaround-ed with r284245.
The callout(9) bug being fixed with r286880, we can now revert the
workaround (r284245).

Differential Revision: https://reviews.freebsd.org/D2079 (Initial change)
Differential Revision: https://reviews.freebsd.org/D2763 (Workaround)
Differential Revision: https://reviews.freebsd.org/D3078 (Fix)
Sponsored by: Verisign, Inc.
MFC after: 2 weeks

8 years agospa_import_rootpool: prevent lock and resource leak
avg [Mon, 24 Aug 2015 08:44:44 +0000 (08:44 +0000)]
spa_import_rootpool: prevent lock and resource leak

The lock leak could lead to a deadlock later.

PR: 198563
Submitted by: Fabian Keil <fk@fabiankeil.de>
MFC after: 1 week

8 years agoaccount for ashift when gathering buffers to be written to l2arc device
avg [Mon, 24 Aug 2015 08:10:52 +0000 (08:10 +0000)]
account for ashift when gathering buffers to be written to l2arc device

The change that introduced the L2ARC compression support also introduced
a bug where the on-disk size of the selected buffers could end up larger
than the target size if the ashift is greater than 9.  This was because
the buffer selection could did not take into account the fact that
on-disk size could be larger than the in-memory buffer size due to
the alignment requirements.

At the moment b_asize is a misnomer as it does not always represent the
allocated size: if a buffer is compressed, then the compressed size is
properly rounded (on FreeBSD), but if the compression fails or it is not
applied, then the original size is kept and it could be smaller than what
ashift requires.

For the same reasons arcstat_l2_asize and the reported used space
on the cache device could be smaller than the actual allocated size
if ashift > 9.  That problem is not fixed by this change.

This change only ensures that l2ad_hand is not advanced by more
than target_sz.  Otherwise we would overwrite active (unevicted)
L2ARC buffers.  That problem is manifested as growing l2_cksum_bad
and l2_io_error counters.

This change also changes 'p' prefix to 'a' prefix in a few places
where variables represent allocated rather than physical size.

The resolved problem could also result in the reported allocated size
being greater than the cache device's capacity, because of the
overwritten buffers (more than one buffer claiming the same disk
space).

This change is already in ZFS-on-Linux:
zfsonlinux/zfs@ef56b0780c80ebb0b1e637b8b8c79530a8ab3201

PR: 198242
PR: 195746 (possibly related)
Reviewed by: mahrens (https://reviews.csiden.org/r/229/)
Tested by: gkontos@aicom.gr (most recently)
MFC after: 15 days
X-MFC note: patch does not apply as is at the moment
Relnotes: yes
Sponsored by: ClusterHQ
Differential Revision: https://reviews.freebsd.org/D2764
Reviewed by: noone (@FreeBSD.org)

8 years agoSync HPA and VPA implementations with CUP.
ed [Mon, 24 Aug 2015 07:49:27 +0000 (07:49 +0000)]
Sync HPA and VPA implementations with CUP.

After fixing the 16-bits integer arithmetic overflow in 286981, we
should also make sure to fix the VPA sequence. Bring HPA and VPA in sync
with how we now implement CUP.

PR: 202612
Reported by: kcwu csie org
MFC after: 1 month

8 years agoAdd static and remove unused variables.
hrs [Mon, 24 Aug 2015 05:38:05 +0000 (05:38 +0000)]
Add static and remove unused variables.

8 years agoImplement the IPv6 RSS software hash function.
adrian [Mon, 24 Aug 2015 05:36:08 +0000 (05:36 +0000)]
Implement the IPv6 RSS software hash function.

This isn't yet linked into the receive/transmit paths anywhere just yet.

This is part of a GSoC 2015 project.

Submitted by: Tiwei Bie <btw@mail.ustc.edu.cn>
Reviewed by: hiren, gnn
Differential Revision: https://reviews.freebsd.org/D3423

8 years agoRemove obsolete API (SIOCGDRLST_IN6 and SIOCGPRLST_IN6) support.
hrs [Mon, 24 Aug 2015 05:28:23 +0000 (05:28 +0000)]
Remove obsolete API (SIOCGDRLST_IN6 and SIOCGPRLST_IN6) support.

8 years ago- Deprecate IN6_IFF_NODAD. It was used to prevent DAD on a loopback
hrs [Mon, 24 Aug 2015 05:21:49 +0000 (05:21 +0000)]
- Deprecate IN6_IFF_NODAD.  It was used to prevent DAD on a loopback
  interface but in6if_do_dad() already had a check for IFF_LOOPBACK.

- Remove in6if_do_dad() check in in6_broadcast_ifa().  An address
  which needs DAD always has IN6_IFF_TENTATIVE there.

- in6if_do_dad() now returns EAGAIN when the interface is not ready
  since DAD callout handler ignores such an interface.

- In DAD callout handler, mark an address as IN6_IFF_TENTATIVE
  when the interface has ND6_IFF_IFDISABLED.  And Do IFF_UP and
  IFF_DRV_RUNNING check consistently when DAD is required.

- draft-ietf-6man-enhanced-dad is now published as RFC 7527.

- Fix some typos.

8 years agoInstead of doing an no-op (|= 0), actually clear the flags in
delphij [Mon, 24 Aug 2015 04:49:20 +0000 (04:49 +0000)]
Instead of doing an no-op (|= 0), actually clear the flags in
acl_clear_flags_np.

MFC after: 2 weeks

8 years agoFix static fdt support.
jhibbits [Mon, 24 Aug 2015 04:39:07 +0000 (04:39 +0000)]
Fix static fdt support.

FDT_DTB_STATIC is defined in opt_platform.h, and fdt_static_dtb is in
fdt_common.h, so include those files.

Sponsored by: Alex Perez/Inertial Computing

8 years agoFix spelling.
araujo [Mon, 24 Aug 2015 01:53:18 +0000 (01:53 +0000)]
Fix spelling.

Reviewed by: wblock, pfg
Approved by: bapt (mentor)
Differential Revision: D3380

8 years agoUpdate bzero(3) manpage to following the Posix Standard.
araujo [Mon, 24 Aug 2015 01:51:10 +0000 (01:51 +0000)]
Update bzero(3) manpage to following the Posix Standard.

Reviewed by: wblock, pfg
Approved by: bapt (mentor)
Differential Revision: D3380

8 years agoMake it clear that we're ignoring the return value fread(3). All
imp [Mon, 24 Aug 2015 00:34:09 +0000 (00:34 +0000)]
Make it clear that we're ignoring the return value fread(3). All
errors that might happen here will be reported a few lines down.

CID: 1295248

8 years agoWe need to add the soft float to the CFLAGS always, not just when
imp [Mon, 24 Aug 2015 00:03:51 +0000 (00:03 +0000)]
We need to add the soft float to the CFLAGS always, not just when
NO_CPUCFLAGS is not defined since it is part of the ABI as we've
defined it, not just a nice optimization.

8 years agoSparc64 is the odd-man out, so form the if that way rather than
imp [Sun, 23 Aug 2015 23:12:30 +0000 (23:12 +0000)]
Sparc64 is the odd-man out, so form the if that way rather than
listing everybody else.

8 years agoEnable KDTRACE_HOOKS by default on all armv6 kernels to get more testing.
andrew [Sun, 23 Aug 2015 21:10:20 +0000 (21:10 +0000)]
Enable KDTRACE_HOOKS by default on all armv6 kernels to get more testing.

8 years agosh: Don't create bad parse result when postponing a bad substitution error.
jilles [Sun, 23 Aug 2015 20:44:53 +0000 (20:44 +0000)]
sh: Don't create bad parse result when postponing a bad substitution error.

An invalid substitution like ${var@} does not cause a parse error but is
stored in the intermediate representation, to be written as part of the
error message. If there is a CTL* byte in the stored part, this confuses
some code such as the code to skip an unused alternative such as in
${var-alternative}.

To keep things simple, do not store CTL* bytes.

Found with afl-fuzz.

MFC after: 1 week

8 years agoUpdate svnlite(1) commit template. This makes it possible to set the
trasz [Sun, 23 Aug 2015 15:20:49 +0000 (15:20 +0000)]
Update svnlite(1) commit template.  This makes it possible to set the
"freebsd-sponsored-by" and "freebsd-mfc-after" in ~/.subversion/config,
in the "[miscellany]" section - just like you already can with
devel/subversion port/package.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

8 years agoAfter r286237 it should be fine to call vgone(9) on a busy GEOM vnode;
trasz [Sun, 23 Aug 2015 14:53:54 +0000 (14:53 +0000)]
After r286237 it should be fine to call vgone(9) on a busy GEOM vnode;
remove KASSERT that would prevent forced devfs unmount from working.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

8 years agoTweak the "rctl_enable" description to not give the impression
trasz [Sun, 23 Aug 2015 13:51:06 +0000 (13:51 +0000)]
Tweak the "rctl_enable" description to not give the impression
of being disabled by default.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

8 years agoHandle the breakpoint instruction in userland by sending a SIGTRAP signal.
andrew [Sun, 23 Aug 2015 13:18:56 +0000 (13:18 +0000)]
Handle the breakpoint instruction in userland by sending a SIGTRAP signal.

8 years agoAlthough the website [1] says US-ASCII is accepted, ISO-8859-1 seems to
delphij [Sun, 23 Aug 2015 08:22:00 +0000 (08:22 +0000)]
Although the website [1] says US-ASCII is accepted, ISO-8859-1 seems to
be the only accepted character that is close enough to US-ASCII (and
this is also done on OpenBSD; the alternative would be to use UTF-8).

[1] http://www.denic.de/en/domains/technik/denic_whois-server/index.html

MFC after: 2 weeks

8 years agoReset the channel to the first available channel if the interface
adrian [Sun, 23 Aug 2015 01:17:52 +0000 (01:17 +0000)]
Reset the channel to the first available channel if the interface
is configured on a channel that isn't valid in the new operating mode.

This isn't strictly true - it should find the first channel that is
available for the given operating mode.

However, I think defaulting to the first channel is fine - it's typically
available for all modes.

If someone would like to correctly implement this feature - try to
find a channel that is valid for the given operating mode and error
out if we can't find one.

This prevents various NICs (eg wpi(4)) from throwing a firmware error.

Tested:

* ath(4), STA/AP mode
* iwn(4), STA/adhoc mode

PR: kern/202502
Submitted by: Andriy Voskoboinyk <s3erios@gmail.com>

8 years agoRemove cust_pkg() not that pkg_foo(1) has been removed.
imp [Sat, 22 Aug 2015 23:09:19 +0000 (23:09 +0000)]
Remove cust_pkg() not that pkg_foo(1) has been removed.

8 years agoRemove some code duplication by using biofinish().
mav [Sat, 22 Aug 2015 15:58:35 +0000 (15:58 +0000)]
Remove some code duplication by using biofinish().

Submitted by: imp
MFC after: 1 week

8 years agoMake the UMA harvesting go away completely if not wanted. Default to "not wanted".
markm [Sat, 22 Aug 2015 12:59:05 +0000 (12:59 +0000)]
Make the UMA harvesting go away completely if not wanted. Default to "not wanted".
Provide and document the RANDOM_ENABLE_UMA option.

Change RANDOM_FAST to RANDOM_UMA to clarify the harvesting.

Remove RANDOM_DEBUG option, replace with SDT probes. These will be of
use to folks measuring the harvesting effect when deciding whether to
use RANDOM_ENABLE_UMA.

Requested by: scottl and others.
Approved by: so (/dev/random blanket)
Differential Revision:    https://reviews.freebsd.org/D3197

8 years agoFix build when LEAPSECONDS is enabled.
delphij [Sat, 22 Aug 2015 07:41:28 +0000 (07:41 +0000)]
Fix build when LEAPSECONDS is enabled.

MFC after: 2 weeks

8 years agoMFV r287019: leapseconds from tzdata2015f.
delphij [Sat, 22 Aug 2015 07:40:51 +0000 (07:40 +0000)]
MFV r287019: leapseconds from tzdata2015f.

MFC after: 2 weeks

8 years agoFollow up to r287014
jhibbits [Sat, 22 Aug 2015 07:27:06 +0000 (07:27 +0000)]
Follow up to r287014

Missed these files, from the original diff.
Sponsored by: Alex Perez/Inertial Computing
Differential Revision: https://reviews.freebsd.org/D3027

8 years agoEnhance book-e pmap for 36-bit physaddr
jhibbits [Sat, 22 Aug 2015 07:20:03 +0000 (07:20 +0000)]
Enhance book-e pmap for 36-bit physaddr

Summary:
This is (probably step 1) of enhancing the book-e pmap to support the full
36-bit physical address space on Freescale e500 and e5500 cores.

Thus far it has only been regression tested on one platform.  Since I only have
one other Book-E platform (e5500), that needs work beyond this, I haven't yet
tested it on this.

Test Plan: Regression tested on my RouterBoard RB800.

Reviewed By: marcel
Differential Revision: https://reviews.freebsd.org/D3027

8 years agoCreate a RouterBoard platform and use it to create a flash map
jhibbits [Sat, 22 Aug 2015 05:50:18 +0000 (05:50 +0000)]
Create a RouterBoard platform and use it to create a flash map

Summary:
The RouterBoard uses a predefined partition map which doesn't exist in the fdt.
This change allows overriding the fdt slicer with a custom slicer, and uses this
custom slicer to define the flash map on the RouterBoard RB800.
D3305 converts the mpc85xx platform into a base class, so that systems based on
the mpc85xx platform can add their own overrides.  This change builds on D3305,
and creates a RouterBoard (RB800) platform to initialize the slicer override.

Reviewed By: nwhitehorn, imp
Differential Revision: https://reviews.freebsd.org/D3345

8 years agoMake pkill/pgrep -j ARG take jname, not just jid.
jamie [Sat, 22 Aug 2015 05:04:36 +0000 (05:04 +0000)]
Make pkill/pgrep -j ARG take jname, not just jid.

PR: 201588
Submitted by: Daniel Shahaf <danielsh at apache.org>
MFC after: 3 days

8 years agoMake the mpc85xx platform a kobj base class.
jhibbits [Sat, 22 Aug 2015 03:29:12 +0000 (03:29 +0000)]
Make the mpc85xx platform a kobj base class.

Summary:
Some systems are based around mpc85xx, but need special initialization.  By
making the mpc85xx platform a base class, these systems can be platform
subclasses, and perform board-specific initialization in addition to the mpc85xx
initialization.

Test Plan:
Tested on my RB800.  A platform class was created, and will be committed
separately.

Reviewed By: nwhitehorn
Differential Revision: https://reviews.freebsd.org/D3305

8 years agoAdd ALTQ(9) support for the CoDel algorithm.
loos [Fri, 21 Aug 2015 22:02:22 +0000 (22:02 +0000)]
Add ALTQ(9) support for the CoDel algorithm.

CoDel is a parameterless queue discipline that handles variable bandwidth
and RTT.

It can be used as the single queue discipline on an interface or as a sub
discipline of existing queue disciplines such as PRIQ, CBQ, HFSC, FAIRQ.

Differential Revision: https://reviews.freebsd.org/D3272
Reviewd by: rpaulo, gnn (previous version)
Obtained from: pfSense
Sponsored by: Rubicon Communications (Netgate)

8 years agoWe're waiting on a struct proc *, not a struct thread *. Fix a
imp [Fri, 21 Aug 2015 21:47:29 +0000 (21:47 +0000)]
We're waiting on a struct proc *, not a struct thread *. Fix a
comment that was wrong.

8 years agoDocument bsd.compiler.mk and the variables it defines.
imp [Fri, 21 Aug 2015 19:51:27 +0000 (19:51 +0000)]
Document bsd.compiler.mk and the variables it defines.

8 years agoDocument CFLAGS_NO_SIMD.
imp [Fri, 21 Aug 2015 19:51:19 +0000 (19:51 +0000)]
Document CFLAGS_NO_SIMD.

8 years agoFix the racy xargs -P0 -n2 test added in r286289
ngie [Fri, 21 Aug 2015 18:42:57 +0000 (18:42 +0000)]
Fix the racy xargs -P0 -n2 test added in r286289

Sort the output obtained from xargs and the expected output
to ensure the end result versus the input file is stable

Differential Revision: D3432
Submitted by: Nikolai Lifanov <lifanov@mail.lifanov.com>

8 years agoDisable the -P0 test
ngie [Fri, 21 Aug 2015 17:47:17 +0000 (17:47 +0000)]
Disable the -P0 test

It's unreliable (sometimes it passes, sometimes it fails)

Reported by: Jenkins (many times over the past few weeks)

8 years agoFix typos (depreciated -> deprecated)
ngie [Fri, 21 Aug 2015 17:45:18 +0000 (17:45 +0000)]
Fix typos (depreciated -> deprecated)

8 years agoEliminate pointless assignments to rtvals[] in swap_pager_putpages().
alc [Fri, 21 Aug 2015 17:00:39 +0000 (17:00 +0000)]
Eliminate pointless assignments to rtvals[] in swap_pager_putpages().

Reviewed by: kib
Sponsored by: EMC / Isilon Storage Division

8 years agoDocument bsd.arch.inc.mk.
imp [Fri, 21 Aug 2015 16:05:56 +0000 (16:05 +0000)]
Document bsd.arch.inc.mk.

8 years agopreload_search_info: make sure mod is set
royger [Fri, 21 Aug 2015 15:57:57 +0000 (15:57 +0000)]
preload_search_info: make sure mod is set

Add a check to preload_search_info to make sure mod is set. Most of the
callers of preload_search_info don't check that the mod parameter is
set, which can cause page faults. While at it, remove some now unnecessary
checks before calling preload_search_info.

Sponsored by: Citrix Systems R&D
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D3440

8 years agoxen: allow disabling PV disks and nics
royger [Fri, 21 Aug 2015 15:53:08 +0000 (15:53 +0000)]
xen: allow disabling PV disks and nics

Introduce two new loader tunnables that can be used to disable PV disks and
PV nics at boot time. They default to 0 and should be set to 1 (or any
number different than 0) in order to disable the PV devices:

hw.xen.disable_pv_disks=1
hw.xen.disable_pv_nics=1

In /boot/loader.conf will disable both PV disks and nics.

Sponsored by: Citrix Systems R&D
Tested by: Karl Pielorz <kpielorz_lst@tdx.co.uk>
MFC after: 1 week

8 years agoMark bsd.info.mk as depreciated
bapt [Fri, 21 Aug 2015 15:30:50 +0000 (15:30 +0000)]
Mark bsd.info.mk as depreciated

8 years agovt_cpulogos: Resize all terms/windows when tearing down logos
cem [Fri, 21 Aug 2015 15:21:56 +0000 (15:21 +0000)]
vt_cpulogos: Resize all terms/windows when tearing down logos

PR: 202288 (partial)
Tested by: Jakob Alvermark
Reviewed by: ed
Approved by: markj (mentor)
Sponsored by: EMC / Isilon Storage Division
Differential Revision: https://reviews.freebsd.org/D3388

8 years agoDocument bsd.progs.mk, including its status as being strongly
imp [Fri, 21 Aug 2015 15:15:22 +0000 (15:15 +0000)]
Document bsd.progs.mk, including its status as being strongly
discouraged and that it will be going away as soon as is practicable.

8 years agoAutomatically disable x2APIC mode on SandyBridge Lenovo machines. I
kib [Fri, 21 Aug 2015 15:13:25 +0000 (15:13 +0000)]
Automatically disable x2APIC mode on SandyBridge Lenovo machines.  I
believe that the bug only affects mobile CPUs, at least I did not see
other reports, but it is impossible to detect it in madt_setup_local().

While there, reduce duplication in the information strings printed
when x2APIC is auto-disabled, and do not print the line when user
manually override the setting.

Tested and reviewed by:   royger (previous version)
Sponsored by: The FreeBSD Foundation

8 years agoFix err pointer not initialized to NULL resulting
bapt [Fri, 21 Aug 2015 14:28:14 +0000 (14:28 +0000)]
Fix err pointer not initialized to NULL resulting

Reported by: "O. Hartmann" <ohartman@zedat.fu-berlin.de>

8 years agoTurn off gcc's uninitialized warnings for this code. They
imp [Fri, 21 Aug 2015 14:15:54 +0000 (14:15 +0000)]
Turn off gcc's uninitialized warnings for this code. They
can be fixed, but really do appear to be false alarms.

8 years agoFix typo in regression test
bapt [Fri, 21 Aug 2015 11:25:42 +0000 (11:25 +0000)]
Fix typo in regression test

8 years agoFix /home symlink creation
bapt [Fri, 21 Aug 2015 09:28:20 +0000 (09:28 +0000)]
Fix /home symlink creation

Add regression test about it

8 years agotry to fix lor between z_teardown_lock and spa_namespace_lock
avg [Fri, 21 Aug 2015 08:17:44 +0000 (08:17 +0000)]
try to fix lor between z_teardown_lock and spa_namespace_lock

The lock order reversal and a resulting deadlock were introduced
in r285021 / D2865.  The problem is that zfs_register_callbacks() calls
dsl_prop_get_integer() that has to acquire spa_namespace_lock.
At the same time, spa_config_sync() is called with spa_namespace_lock
held and then it performs ZFS vnode operations that acquire
z_teardown_lock in the reader mode.

So, fix the problem by using dsl_prop_get_int_ds() instead of
dsl_prop_get_integer().  The former does not need to look up
the pool and the dataset by name.

Reported by: many
Reviewed by: delphij
Tested by: delphij, Jens Schweikhardt <schweikh@schweikhardt.net>
MFC after: 5 days
X-MFC with: r285021

8 years agofix standalone build of zfs module
avg [Fri, 21 Aug 2015 08:06:18 +0000 (08:06 +0000)]
fix standalone build of zfs module

Not sure if this is a proper fix, but it does the job.

8 years agofix a mismerge in r286539 (MFV 286538: 5562 ZFS sa_handle's violate...)
avg [Fri, 21 Aug 2015 08:04:56 +0000 (08:04 +0000)]
fix a mismerge in r286539 (MFV 286538: 5562 ZFS sa_handle's violate...)

PR: 202358
X-MFC with: r286539
X-MFC attn: mav

8 years agoFix useradd regression:
bapt [Fri, 21 Aug 2015 07:09:53 +0000 (07:09 +0000)]
Fix useradd regression:

Readd the function to create the parents home directory if it does not exists.
if it is only a directory at the top level of the hierarchy symlink it into /usr
as it used to be done before.

Reported by: kevlo, adrian

8 years agoDon't truncate cursor arithmetic to 16 bits.
ed [Fri, 21 Aug 2015 06:30:13 +0000 (06:30 +0000)]
Don't truncate cursor arithmetic to 16 bits.

When updating the row number when the cursor position escape sequence is
issued, we should make sure to store the intermediate result in a 32-bit
integer. If we fail to do this, the cursor may be set above the origin
region, which is bad.

This could cause libteken to crash when INVARIANTS is enabled, due to
the strict set of assertions that libteken has.

PR: 202540
Reported by: kcwu csie org
MFC after: 1 month

8 years agoEditing pass on procctl.2
bjk [Fri, 21 Aug 2015 02:42:14 +0000 (02:42 +0000)]
Editing pass on procctl.2

Spell "descendant" correctly.

Grammar fixes.

Use correct width argument to Bl.

Use Po and Pc to avoid leaving a dangling '(' on the end of a line.

8 years agoAdd initial boot support for e500mc and e5500.
jhibbits [Fri, 21 Aug 2015 02:41:35 +0000 (02:41 +0000)]
Add initial boot support for e500mc and e5500.

* Since r257190 the kernel must actually be loaded at a 64MB boundary, not 16MB.
* Don't program HID1 register on e500mc or e5500, they don't have this SPR.
* Set proper HID0 defaults for these new architectures.

There is still more work to be done for the various SoCs, and the PMAP code
still needs to be extended to 36-bit paddr, coming soon.

Obtained from: Semihalf
Sponsored by: Alex Perez/Inertial Computing

8 years agoSimplify the PCI bus scanning logic.
jhibbits [Fri, 21 Aug 2015 02:22:51 +0000 (02:22 +0000)]
Simplify the PCI bus scanning logic.

Rather than special casing on PCIC_BRIDGE || PCIC_PROCESSOR, allow all
HDRTYPE_BRIDGE types.

Obtained from: Semihalf
Sponsored by: Alex Perez/Intertial Computing

8 years agoIf process becomes reaper (procctl(PROC_REAP_ACQUIRE)) while already
kib [Thu, 20 Aug 2015 22:44:26 +0000 (22:44 +0000)]
If process becomes reaper (procctl(PROC_REAP_ACQUIRE)) while already
having some children, the children' reaper is not reset to the parent.
This allows for the situation where reaper has children but not
descendands and the too strict asserts in the reap_status() fire.

Remove the wrong asserts, add some clarification for the situation to
the procctl(2) REAP_STATUS.

Reported and tested by: feld
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

8 years agoRemove reference to non-existent kern_openat(9).
bdrewery [Thu, 20 Aug 2015 22:14:43 +0000 (22:14 +0000)]
Remove reference to non-existent kern_openat(9).

MFC after: 3 days
Sponsored by: EMC / Isilon Storage Division

8 years agosh: Avoid negative character values from $'\Uffffffff' etc.
jilles [Thu, 20 Aug 2015 22:05:55 +0000 (22:05 +0000)]
sh: Avoid negative character values from $'\Uffffffff' etc.

The negative value was not expected and generated the low 8 bits as a byte,
which may be an invalid character encoding.

The final shift in creating the negative value was undefined as well.

Make the temporary variable unsigned to fix this.

8 years agoAppease gcc-4.2
pfg [Thu, 20 Aug 2015 21:49:59 +0000 (21:49 +0000)]
Appease gcc-4.2

It needs to die, but it resists mipsteriously.

Submitted by: Oliver Pinter

8 years agosh: Add test for $'\u' without any digits.
jilles [Thu, 20 Aug 2015 21:31:36 +0000 (21:31 +0000)]
sh: Add test for $'\u' without any digits.

It is likely that $'\uXXXX' and $'\UXXXXXXXX' will allow fewer digits in
future. However, no digits at all should still be disallowed.

8 years agoPrevent ticks rollover from preventing vm_lowmem event
rstone [Thu, 20 Aug 2015 20:28:51 +0000 (20:28 +0000)]
Prevent ticks rollover from preventing vm_lowmem event

Currently vm_pageout_scan() uses a ticks-based scheme to rate-limit
the number of times that the vm_lowmem event will happen.  However
if no events happen for long enough for ticks to roll over, this
leaves us in a long window in which vm_lowmem events will not
happen.

Replace the use of ticks with time_t to prevent rollover from ever
being an issue.

Reviewed by: ian
MFC after: 3 weeks
Sponsored by: EMC / Isilon Storage Division
Differential Revision: https://reviews.freebsd.org/D3439

8 years agoRemove code left over from the armv4 days. On armv4, cache maintenance
ian [Thu, 20 Aug 2015 19:39:15 +0000 (19:39 +0000)]
Remove code left over from the armv4 days.  On armv4, cache maintenance
operations always had to be aligned and sized to cache lines.  On armv6
and later, cache maintenance operates on a cache line if any part of
the line is referenced in the operation, so we don't need extra code to
align the edges of the sync range.

8 years agoMinor comment and style fixes, no functional change.
ian [Thu, 20 Aug 2015 19:14:16 +0000 (19:14 +0000)]
Minor comment and style fixes, no functional change.

Submitted by: Svatopluk Kraus <onwahe@gmail.com>

8 years agoThe flags -mno-aes -mno-avx only exist for clang, not gcc, so
imp [Thu, 20 Aug 2015 18:31:05 +0000 (18:31 +0000)]
The flags -mno-aes -mno-avx only exist for clang, not gcc, so
add them only to the clang CFLAGS.

8 years agoAdd link for rw_unlock(9) to rwlock(9).
bdrewery [Thu, 20 Aug 2015 18:22:06 +0000 (18:22 +0000)]
Add link for rw_unlock(9) to rwlock(9).

MFC after: 3 days
Sponsored by: EMC / Isilon Storage Division

8 years agoRevamp camcontrol(8) fwdownload support and add the opcodes subcommand.
ken [Thu, 20 Aug 2015 16:07:51 +0000 (16:07 +0000)]
Revamp camcontrol(8) fwdownload support and add the opcodes subcommand.

The significant changes and bugs fixed here are:

1. Fixed a bug in the progress display code:

   When the user's filename is too big, or his terminal width is too
   small, the progress code could wind up using a negative number for
   the length of the "stars" that it uses to indicate progress.

   This negative value was assigned to an unsigned variable, resulting
   in a very large positive value.

   The result is that we wound up writing garbage from memory to the
   user's terminal.

   With an 80 column terminal, a file name length of more than 35
   characters would generate this problem.

   To address this, we now set a minimum progress bar length, and
   truncate the user's file name as needed.

   This has been tested with large filenames and small terminals, and
   at least produces reasonable results.  If the terminal is too
   narrow, the progress display takes up an additional line with each
   update, but this is more user friendly than writing garbage to the
   tty.

2. SATA drives connected via a SATA controller didn't have SCSI Inquiry
   data populated in struct cam_device.  This meant that the code in
   fw_get_vendor() in fwdownload.c would try to match a zero-length
   vendor ID, and so return the first entry in the vendor table.  (Which
   used to be HITACHI.)  Fixed by grabbing identify data, passing the
   identify buffer into fw_get_vendor(), and matching against the model
   name.

3. SATA drives connected via a SAS controller do have Inquiry data
   populated.  The table included a couple of entries -- "ATA ST" and
   "ATA HDS", intended to handle Seagate and Hitachi SATA drives attached
   via a SAS controller.  SCSI to ATA translation layers use a vendor
   ID of "ATA" (which is standard), and then the model name from the ATA
   identify data as the SCSI product name when they are returning data on
   SATA disks.  The cam_strmatch code will match the first part of the
   string (because the length it is given is the length of the vendor,
   "ATA"), and return 0 (i.e. a match).  So all SATA drives attached to
   a SAS controller would be programmed using the Seagate method
   (WRITE BUFFER mode 7) of SCSI firmware downloading.

4. Issue #2 above covered up a bug in fw_download_img() -- if the
   maximum packet size in the vendor table was 0, it tried to default
   to a packet size of 32K.  But then it didn't actually succeed in
   doing that, because it set the packet size to the value that was
   in the vendor table (0).  Now that we actually have ATA attached
   drives fall use the VENDOR_ATA case, we need a reasonable default
   packet size.  So this is fixed to properly set the default packet size.

5. Add support for downloading firmware to IBM LTO drives, and add a
   firmware file validation method to make sure that the firmware
   file matches the drive type.  IBM tape drives include a Load ID and
   RU name in their vendor-specific VPD page 0x3.  Those should match
   the IDs in the header of the firmware file to insure that the
   proper firmware file is loaded.

6. This also adds a new -q option to the camcontrol fwdownload
   subcommand to suppress informational output.  When -q is used in
   combination with -y, the firmware upgrade will happen without
   prompting and without output except if an error condition occurs.

7. Re-add support for printing out SCSI inquiry information when
   asking the user to confirm that they want to download firmware, and
   add printing of ATA Identify data if it is a SATA disk.  This was
   removed in r237281 when support for flashing ATA disks was added.

8. Add a new camcontrol(8) "opcodes" subcommand, and use the
   underlying code to get recommended timeout values for drive
   firmware downloads.

   Many SCSI devices support the REPORT SUPPORTED OPERATION CODES
   command, and some support the optional timeout descriptor that
   specifies nominal and recommended timeouts for the commands
   supported by the device.

   The new camcontrol opcodes subcommand allows displaying all
   opcodes supported by a drive, information about which fields
   in a SCSI CDB are actually used by a given SCSI device, and the
   nominal and recommended timeout values for each command.

   Since firmware downloads can take a long time in some devices, and
   the time varies greatly between different types of devices, take
   advantage of the infrastructure used by the camcontrol opcodes
   subcommand to determine the best timeout to use for the WRITE
   BUFFER command in SCSI device firmware downloads.

   If the device recommends a timeout, it is likely to be more
   accurate than the default 50 second timeout used by the firmware
   download code.  If the user specifies a timeout, it will override
   the default or device recommended timeout.  If the device doesn't
   support timeout descriptors, we fall back to the default.

9. Instead of downloading firmware to SATA drives behind a SAS controller
   using WRITE BUFFER, use the SCSI ATA PASS-THROUGH command to compose
   an ATA DOWNLOAD MICROCODE command and it to the drive.  The previous
   version of this code attempted to send a SCSI WRITE BUFFER command to
   SATA drives behind a SAS controller.  Although that is part of the
   SAT-3 spec, it doesn't work with the parameters used with LSI
   controllers at least.

10.Add a new mechanism for making common ATA passthrough and
   ATA-behind-SCSI passthrough commands.

   The existing camcontrol(8) ATA command mechanism checks the device
   type on every command executed.  That works fine for individual
   commands, but is cumbersome for things like a firmware download
   that send a number of commands.

   The fwdownload code detects the device type up front, and then
   sends the appropriate commands.

11.In simulation mode (-s), if the user specifies the -v flag, print out
   the SCSI CDB or ATA registers that would be sent to the drive.  This will
   aid in debugging any firmware download issues.

sbin/camcontrol/fwdownload.c:
Add a device type to the fw_vendor structure, so that we can
specify different download methods for different devices from the
same vendor.  In this case, IBM hard drives (from when they
still made hard drives) and tape drives.

Add a tur_status field to the fw_vendor structure so that we can
specify whether the drive to be upgraded should be ready, not
ready, or whether it doesn't matter.  Add the corresponding
capability in fw_download_img().

Add comments describing each of the vendor table fields.

Add HGST and SmrtStor to the supported SCSI vendors list.

In fw_get_vendor(), look at ATA identify data if we have a SATA
device to try to identify what the drive vendor is.

Add IBM firmware file validation.  This gets VPD page 0x3, and
compares the Load ID and RU name in the page to the values
included in the header.  The validation code will refuse to load
a firmware file if the values don't match.  This does allow the
user to attempt a downgrade; whether or not it succeeds will
likely depend on the drive settings.

Add a -q option, and disable all informative output
(progress bars, etc.) when this is enabled.

Re-add the inquiry in the confirmation dialog so the user has
a better idea of which device he is talking to.  Add support for
displaying ATA identify data.

Don't automatically disable confirmation in simulation (-s) mode.
This allows the user to see the inquiry or identify data in the
dialog, and see exactly what they would see when the command
actually runs.  Also, in simulation mode, if the user specifies
the -v flag, print out the SCSI CDB or ATA registers that would
be sent to the drive.  This will aid in debugging any firmware
download issues.

Add a timeout field and timeout type to the firmware download
vendor table.  This allows specifying a default timeout and allows
specifying whether we should attempt to probe for a recommended
timeout from the drive.

Add a new fuction, fw_get_timeout(), that will determine
which timeout to use for the WRITE BUFFER command.  If the
user specifies a timeout, we always use that.  Otherwise,
we will use the drive recommended timeout, if available,
and fall back to the default when a drive recommended
timeout isn't available.

When we prompt the user, tell him what timeout we're going
to use, and the source of the timeout.

Revamp the way SATA devices are handled.

In fwdownload(), use the new get_device_type() function to
determine what kind of device we're talking to.

Allow firmware downloads to any SATA device, but restrict
SCSI downloads to known devices.  (The latter is not a
change in behavior.)

Break out the "ready" check from fw_download_img() into a
new subfunction, fw_check_device_ready().  This sends the
appropriate command to the device in question -- a TEST
UNIT READY or an IDENTIFY.  The IDENTIFY for SATA devices
  a SAT layer is done using the SCSI ATA PASS-THROUGH
command.

Use the new build_ata_cmd() function to build either a SCSI or
ATA I/O CCB to issue the DOWNLOAD MICROCODE command to SATA
devices.  build_ata_cmd() figures looks at the devtype argument
and fills in the correct CCB type and CDB or ATA registers.

Revamp the vendor table to remove the previous
vendor-specific ATA entries and use a generic ATA vendor
placeholder.  We currently use the same method for all ATA
drives, although we may have to add vendor-specific
behavior once we test this with more drives.

sbin/camcontrol/progress.c:
In progress_draw(), make barlength a signed value so that
we can easily detect a negative value.

If barlength (the length of the progress bar) would wind up
negative due to a small TTY width or a large filename,
set the bar length to the new minimum (10 stars) and
truncate the user's filename.  We will truncate it down to
0 characters if necessary.

Calculate a new prefix_len variable (user's filename length)
and use it as the precision when printing the filename.

sbin/camcontrol/camcontrol.c:
Implement a new camcontrol(8) subcommand, "opcodes".  The
opcodes subcommand allows displaying the entire list of
SCSI commands supported by a device, or details on an
individual command.  In either case, it can display
nominal and recommended timeout values.

Add the scsiopcodes() function, which calls the new
scsigetopcodes() function to fetch opcode data from a
drive.

Add two new functions, scsiprintoneopcode() and
scsiprintopcodes(), which print information about one
opcode or all opcodes, respectively.

Remove the get_disk_type() function.  It is no longer used.

Add a new function, dev_has_vpd_page(), that fetches the
supported INQUIRY VPD list from a device and tells the
caller whether the requested VPD page is available.

Add a new function, get_device_type(), that returns a more
precise device type than the old get_disk_type() function.
The get_disk_type() function only distinguished between
SCSI and ATA devices, and SATA devices behind a SCSI to ATA
translation layer were considered to be "SCSI".

get_device_type() offers a third type, CC_DT_ATA_BEHIND_SCSI.
We need to know this to know whether to attempt to send ATA
passthrough commands.  If the device has the ATA
Information VPD page (0x89), then it is an ATA device
behind a SCSI to ATA translation layer.

Remove the type argument from the fwdownload() subcommand.

Add a new function, build_ata_cmd(), that will take one set
of common arguments and build either a SCSI or ATA I/O CCB,
depending on the device type passed in.

sbin/camcontrol/camcontrol.h:
Add a prototype for scsigetopcodes().

Add a new enumeration, camcontrol_devtype.

Add prototypes for dev_has_vpd_page(), get_device_type()
and build_ata_cmd().

Remove the type argument from the fwdownload() subcommand.

sbin/camcontrol/camcontrol.8
Explain that the fwdownload subcommand will use the drive
recommended timeout if available, and that the user can
override the timeout.

Document the new opcodes subcommand.

Explain that we will attempt to download firmware to any
SATA device.

Document supported SCSI vendors, and models tested if known.

Explain the commands used to download firmware for the
three different drive and controller combinations.

Document that the -v flag in simulation mode for the fwdownload
subcommand will print out the SCSI CDBs or ATA registers that would
be used.

sys/cam/scsi/scsi_all.h:
Add new bit definitions for the one opcode descriptor for
the REPORT SUPPORTED OPCODES command.

Add a function prototype for scsi_report_supported_opcodes().

sys/cam/scsi/scsi_all.c:
Add a new CDB building function, scsi_report_supported_opcodes().

Sponsored by: Spectra Logic
MFC after: 1 week

8 years agoAdd ATF functional tests for fstyp(8). No ZFS or GELI tests yet.
asomers [Thu, 20 Aug 2015 15:37:47 +0000 (15:37 +0000)]
Add ATF functional tests for fstyp(8).  No ZFS or GELI tests yet.

Reviewed by: trasz, ngie
MFC after: 2 weeks
Sponsored by: SpectraLogic
Differential Revision: https://reviews.freebsd.org/D2801