Commit Graph

171268 Commits

Author SHA1 Message Date
Kevin Lo
c61325d009 Correct sizeof usage
Obtained from:	DragonFly
2012-06-25 05:41:16 +00:00
Kenneth D. Merry
365e076ed2 Consume spare fields for the providergone pointers added to the g_class and
g_geom structures in change 237518.  The original change would have broken
the ABI.

Suggested by:	ae
MFC after:	4 days
2012-06-25 04:26:10 +00:00
Matt Jacob
d42f4bedba Unbreak register tests for parallel SCSI.
You can't overwrite registers 7 and 8.
MFC after:	3 days
2012-06-25 03:06:29 +00:00
Michael Tuexen
20cc2188f3 Pass the packet length explicitly around.
MFC after: 3 days
2012-06-24 23:12:24 +00:00
Michael Tuexen
329204ff00 Remove redundant check.
MFC after: 3 days
2012-06-24 22:22:44 +00:00
Michael Tuexen
f938425253 Do packet logging in a consistent way.
MFC after: 3 days
2012-06-24 21:25:54 +00:00
Matt Jacob
9e7d423d23 Clean up multi-id mode so it's driven by the f/w loaded,
not by some hint setting.  Do more preparations for FC-Tape.
Clean up resource counting for 24XX or later chipsets so
we find out after EXEC_FIRMWARE what is actually supported.
Set target mode exchange count based upon whether or not
we are supporting simultaneous target/initiator mode. Clean
up some old (pre-24XX) xfwoption and zfwoption issues.

Sponsored by:	Spectralogic
MFC after:	3 days
2012-06-24 17:30:54 +00:00
Andrew Turner
6b14dddf9a Add the sys directory we create to the list of items to clean. 2012-06-24 09:19:24 +00:00
Adrian Chadd
c312fb4adc In a complete lack of foresight on my part, my previous commit broke
the assumption that ath_softc doesn't change size based on build time
configuration.

I picked up on this because suddenly radar stuff didn't work; and
although the ath_dfs code was setting sc_dodfs=1, the main ath driver
saw sc_dodfs=0.

So for now, include opt_ath.h in driver source files.  This seems like
the sane thing to do anyway.

I'll have to do a pass over the code at some later stage and turn
the radiotap TX/RX structs into malloc'ed memory, rather than in-line
inside of ath_softc.  I'd rather like to keep ath_softc the same
layout regardless of configuration parameters.

Pointy hat to: 	adrian
2012-06-24 08:47:19 +00:00
Andrew Turner
ec280fdbf5 Create a symlink to sys/elf32.h, sys/elf64.h, and sys/elf_common.h.
When building libelf in the bootstrap stage this would include the tree
versions of, for example, sys/_types.h. This would work as long as the
tree's version of this file was close enough to the system's version of
the file. If, however, there was a change in the tree such that the location
of a typedef was moved this would cause problems. In this case the version
of sys/_types.h in the tree no longer defines __wchar_t and expects it to
to be defined in machine/_types.h, however we pick up machine/_types.h from
the system and find it is not defined there. The solution is to restrict the
parts of sys er include from the tree to those that are needed.

This fixes the recent Tinderbox failure.

Pointy Hat to:	andrew
2012-06-24 08:43:34 +00:00
Adrian Chadd
f8aa9fd500 Shuffle these initialisations to where they should be. 2012-06-24 08:28:06 +00:00
Adrian Chadd
d77363ad5b Change the ath_dfs_process_phy_err() method to take an mbuf rather than
a buffer pointer.

For large radar pulses, the AR9130 and later will return a series of
FFT results for software processing.  These can overflow a single 2KB
buffer on longer pulses.  This would result in undefined buffer behaviour.
2012-06-24 08:09:06 +00:00
Joel Dahl
f2de8db466 Fix mandoc "Oc breaks Op" warning. 2012-06-24 07:54:28 +00:00
Eitan Adler
43be4ab038 Remove the assert added in r237286
The use of assertions in libraries is not widely accepted.

Requested by:	bde, scottl
Approved by:	cperciva
MFC after:	3 days
X-MFC-With:	r237286
2012-06-24 07:03:22 +00:00
Adrian Chadd
e1b5ab97e8 Introduce an optional ath(4) radiotap vendor extension.
This includes a few new fields in each RXed frame:

* per chain RX RSSI (ctl and ext);
* current RX chainmask;
* EVM information;
* PHY error code;
* basic RX status bits (CRC error, PHY error, etc).

This is primarily to allow me to do some userland PHY error processing
for radar and spectral scan data.  However since EVM and per-chain RSSI
is provided, others may find it useful for a variety of tasks.

The default is to not compile in the radiotap vendor extensions, primarily
because tcpdump doesn't seem to handle the particular vendor extension
layout I'm using, and I'd rather not break existing code out there that
may be (badly) parsing the radiotap data.

Instead, add the option 'ATH_ENABLE_RADIOTAP_VENDOR_EXT' to your kernel
configuration file to enable these options.
2012-06-24 07:01:49 +00:00
Adrian Chadd
a183985e6f On second thought, let's just set both CRC and PHY errors together on
frames that have it and let the upper layer sort it out.

PR:		kern/169362
2012-06-24 06:37:28 +00:00
Adrian Chadd
efb44bb8ca Sometimes the AR5416 sends back radar PHY errors with both the PHY error
and the CRC error bits set.  The radar payload is correct.

When this happens, the stack doesn't see them PHY error frames and
isn't interpreted as a PHY error.  So, no radar detection and no radiotap
PHY error handling.

Now, this may introduce some weird issues if the MAC sends up some other
combination of CRC error + PHY error frames; this commit would break that
and mark them as PHY errors instead of CRC errors.

I may tinker with this a little more to pass radar/early radar/spectral
frames up as PHY errors if the CRC bit is set, to restore the previous
behaviour (where if CRC is set on a PHY error frame, it's marked as a CRC
error rather than PHY error.)

Tested on:	AR5416, over the air, to a USRP N200 which is generating a
		large number of a variety of radar pulses.
TODO:		Test on AR9130, AR9160, AR9280 (and maybe radar pulses on
		2GHz on AR9285/AR9287.)

PR:		kern/169362
2012-06-24 05:59:32 +00:00
Kenneth D. Merry
c3fb2891f0 Fix a bug which causes a panic in daopen(). The panic is caused by
a da(4) instance going away while GEOM is still probing it.

In this case, the GEOM disk class instance has been created by
disk_create(), and the taste of the disk is queued in the GEOM
event queue.

While that event is queued, the da(4) instance goes away.  When the
open call comes into the da(4) driver, it dereferences the freed
(but non-NULL) peripheral pointer provided by GEOM, which results
in a panic.

The solution is to add a callback to the GEOM disk code that is
called when all of its resources are cleaned up.  This is
implemented inside GEOM by adding an optional callback that is
called when all consumers have detached from a provider, and the
provider is about to be deleted.

scsi_cd.c,
scsi_da.c:	In the register routine for the cd(4) and da(4)
		routines, acquire a reference to the CAM peripheral
		instance just before we call disk_create().

		Use the new GEOM disk d_gone() callback to register
		a callback (dadiskgonecb()/cddiskgonecb()) that
		decrements the peripheral reference count once GEOM
		has finished cleaning up its resources.

		In the cd(4) driver, clean up open and close
		behavior slightly.  GEOM makes sure we only get one
		open() and one close call, so there is no need to
		set an open flag and decrement the reference count
		if we are not the first open.

		In the cd(4) driver, use cam_periph_release_locked()
		in a couple of error scenarios to avoid extra mutex
		calls.

geom.h:		Add a new, optional, providergone callback that
		is called when a provider is about to be deleted.

geom_disk.h:	Add a new d_gone() callback to the GEOM disk
		interface.

		Bump the DISK_VERSION to version 2.  This probably
		should have been done after a couple of previous
		changes, especially the addition of the d_getattr()
		callback.

geom_disk.c:	Add a providergone callback for the disk class,
		g_disk_providergone(), that calls the user's
		d_gone() callback if it exists.

		Bump the DISK_VERSION to 2.

geom_subr.c:	In g_destroy_provider(), call the providergone
		callback if it has been provided.

		In g_new_geomf(), propagate the class's
		providergone callback to the new geom instance.

blkfront.c:	Callers of disk_create() are supposed to pass in
		DISK_VERSION, not an explicit disk API version
		number.  Update the blkfront driver to do that.

disk.9:		Update the disk(9) man page to include information
		on the new d_gone() callback, as well as the
		previously added d_getattr() callback, d_descr
		field, and HBA PCI ID fields.

MFC after:	5 days
2012-06-24 04:29:03 +00:00
Andrew Turner
74dc547e24 Make the wchar_t type machine dependent.
This is required for ARM EABI. Section 7.1.1 of the Procedure Call for the
ARM Architecture (AAPCS) defines wchar_t as either an unsigned int or an
unsigned short with the former preferred.

Because of this requirement we need to move the definition of __wchar_t to
a machine dependent header. It also cleans up the macros defining the limits
of wchar_t by defining __WCHAR_MIN and __WCHAR_MAX in the same machine
dependent header then using them to define WCHAR_MIN and WCHAR_MAX
respectively.

Discussed with:	bde
2012-06-24 04:15:58 +00:00
Alan Cox
f745b16359 Introduce reserve_pv_entry() and use it in pmap_pv_demote_pde(). In order
to add PV list locking to pmap_pv_demote_pde(), it is necessary to change
the way that pmap_pv_demote_pde() allocates PV entries.  Specifically,
once pmap_pv_demote_pde() begins modifying the PV lists, it can't allocate
any new PV chunks, because that could require the PV list lock to be
dropped.  So, all necessary PV chunks must be allocated in advance.  To my
surprise, this new approach is a few percent faster than the old one.
2012-06-23 22:54:25 +00:00
Navdeep Parhar
4defc81b0e Better way to determine the status page length and rx pad boundary. 2012-06-23 22:12:27 +00:00
Joel Dahl
d714b2c1ac Remove superfluous paragraph macro. 2012-06-23 20:44:45 +00:00
Mitsuru IWASAKI
154be29631 Add description about dev.acpi_ibm.0.handlerevents.
MFC after:	3 days
2012-06-23 18:45:32 +00:00
Mitsuru IWASAKI
ae2f080bc4 Add in-driver event handler.
MFC after:	3 days
2012-06-23 18:43:54 +00:00
Konstantin Belousov
e1f4f1f860 Correct device id for GPU on some server SandyBridge model.
Submitted and tested by:	Thomas Zander <thomas.e.zander googlemail com>
MFC after:	3 days
2012-06-23 15:36:32 +00:00
Marius Strobl
79e62fee3d Unbreak options ZFS after r236884. 2012-06-23 14:43:25 +00:00
Justin Hibbits
ff1b355c91 Release the ADB keyboard mutex when handling the power button
press/release.  Found by WITNESS.

Approved by:	nwhitehorn (mentor)
MFC after:	3 days
2012-06-23 13:52:44 +00:00
Alexander V. Chernikov
0bfbe5f660 Fix interface matching by ipfw table
Submitted by:     Ihor Kaharlichenko <madkinder@gmail.com>
Tested by:        Ihor Kaharlichenko <madkinder@gmail.com>
Approved by:      kib(mentor)
MFC after:        3 days
2012-06-23 12:40:24 +00:00
Alexander Motin
e7493b2841 Add scsi_extract_sense_ccb() -- wrapper around scsi_extract_sense_len().
It allows to remove number of duplicate checks from several places.
2012-06-23 12:32:53 +00:00
Konstantin Belousov
a665ed986c Move the code dealing with shared page into a dedicated
kern_sharedpage.c source file from kern_exec.c.

MFC after:	  29 days
2012-06-23 10:15:23 +00:00
Konstantin Belousov
c108830417 Remove no longer needed forward declaration for struct sf_buf.
MFC after:	 29 days
2012-06-23 10:14:51 +00:00
Konstantin Belousov
21c295ef88 Stop updating the struct vdso_timehands from even handler executed in
the scheduled task from tc_windup(). Do it directly from tc_windup in
interrupt context [1].

Establish the permanent mapping of the shared page into the kernel
address space, avoiding the potential need to sleep waiting for
allocation of sf buffer during vdso_timehands update. As a
consequence, shared_page_write_start() and shared_page_write_end()
functions are not needed anymore.

Guess and memorize the pointers to native host and compat32 sysentvec
during initialization, to avoid the need to get shared_page_alloc_sx
lock during the update.

In tc_fill_vdso_timehands(), do not loop waiting for timehands
generation to stabilize, since vdso_timehands is written in the same
interrupt context which wrote timehands.

Requested by:	  mav [1]
MFC after:	  29 days
2012-06-23 09:33:06 +00:00
Navdeep Parhar
3c51d1544a Do not allocate extra vectors when adapter is not TOE
capable (or toecaps have been disallowed by the user).

+ one very minor unrelated cleanup in t4_sge.c
2012-06-22 22:59:42 +00:00
Alexander Motin
15a0920e21 Return CAM_SEL_TIMEOUT and CAM_DEV_NOT_THERE instead of CAM_TID_INVALID
and CAM_LUN_INVALID for case of missing devices. In removes tons of error
messages from CAM during bus scans.

Reported and tested by:	Mike Tancsa <mike@sentex.net>
MFC after:	3 days
2012-06-22 21:46:41 +00:00
Bjoern A. Zeeb
23bc7025c4 Just add a comment to further investigate when being closer to that code
again next time.  The condition of the 2nd if() is very unlikely ever met.
2012-06-22 21:26:35 +00:00
Martin Matuska
de37372f73 Import Illumos revision 13736:9f1d48e1681f
2901 ZFS receive fails for exabyte sparse files

References:
https://www.illumos.org/issues/2901

Obtained from:	illumos (issue #2901)
MFC after:	1 week
2012-06-22 20:42:11 +00:00
Kenneth D. Merry
7027b9cda4 Change 'camcontrol defects' to first probe a drive to find out how much
defect information it has before grabbing the full defect list.

This works around a bug with some Hitachi drives that generate data overrun
errors when they are asked for more defect data than they have.

The change is done in a spec-compliant way, so it should have no negative
impact on drives that don't have this issue.

This is based on work originally done at Sandvine.

scsi_da.h:	Add a define for the maximum amount of data that can be
		contained in a defect list.

camcontrol.c:	Update the readdefects() function to issue an initial
		command to determine the length of the defect list, and
		then use that length in the request for the full defect
		list.

camcontrol.8:	Add a note that some drives will report 0 defects available
		if you don't request either the PLIST or GLIST.

Submitted by:	Mark Johnston <markjdb@gmail.com> (original version)
MFC after:	3 days
2012-06-22 18:57:06 +00:00
Attilio Rao
ffdd0c7db3 - Add a comment explaining the locking of the cached pages pool held
by vm_objects.
- Add flags for the per-object lock and free pages queue mutex lock.
  Use the newly added flags to mark the cache root within the vm_object
  structure.

Please note that other vm_object members should be marked with correct
locking but they are left for other commits.

In collabouration with:	alc

MFC after:	3 days3 days3 days
2012-06-22 18:34:11 +00:00
Pedro F. Giffuni
8abd4c975c Merge changes from upstream libedit.
Our libedit has been diverging from the mainstream version
maintained in NetBSD. As a consequence it has been difficult
to do an appropriate MFV and we have been bringing only
partial updates.

Here we update most of the files to at least match the
version available in NetBSD's snapshot of 20091228. This
version was chosen because it still doesn't include wide
character support (UTF-8), which involves many changes and
new files.

From NetBSD's logs:

Dec 15 22:13:33 2006 - editline.3 el.c el.h histedit.h
add EL_GETFP, and EL_SETFP.

Apr 5 15:53:28 2008 - editline.3 el.c histedit.h readline.c
add EL_REFRESH for the benefit of readline

Sep 10 15:45:37 2008 - common.c el.c read.c refresh.c sig.c term.c term.h tty.c
Allow a single process to control multiple ttys (for pthreads using _REENTRANT)
using multiple EditLine objects.

Jan 18 12:17:24 2009 - el.c read.c readline.c
fix -Wsign-compare issues

Feb 6 14:40:32 2009 - history.c
Plug memory leak, from MySQL.

Feb 5 19:15:44 2009 - histedit.h read.c
match documentation in el_push

Feb 6 13:14:37 2009 - vi.c
Portability fix.

Feb 12 13:39:49 2009 - readline.c term.c
More fixes for existing portability stuff.

Feb 15 21:24:13 2009 - el.h read.c
don't restart on EINTR, instead return NULL immediately. From Anon Ymous

Feb 15 21:25:01 2009 - sig.c sig.h
in order for read() to return EINTR we need to use sigaction, not signal,
otherwise SA_RESTART is set.

Feb 15 21:55:23 2009 - chared.c chared.h common.c emacs.c filecomplete.c
filecomplete.h key.c key.h read.c readline.c refresh.c search.c
term.c tokenizer.c tty.c vi.c
pass lint on _LP64.

Feb 17 21:34:26 2009 - el.c histedit.h	prompt.c prompt.h
allow for a prompt argument.

Feb 18 15:04:40 2009 - sig.c
SA_RESTART for all signals but SIGINT. From Anon Ymous.

Feb 19 15:20:22 2009 - read.c sig.c sig.h
reset and redraw on sigcont. From Anon Ymous.

Feb 21 23:31:56 2009 - key.c key.h readline.c vi.c
more size_t stuff.

Mar 10 20:46:15 2009 - editline.3 read.c
make el_gets set the count to -1 on error to distinguish between EOF and
error.

Mar 31 17:38:27 2009 - editline.3 el.c histedit.h prompt.c prompt.h
refresh.c term.c term.h
Implement literal prompt sequences. Now someone can implement
RL_PROMPT_START_LITERAL/RL_PROMPT_END_LITERAL :-)

Mar 31 21:33:17 2009 - term.c
cast to size_t to avoid sign / unsigned comparison warning.

Apr 23 02:03 2009 - term.c
Apply patch (requested by msaitoh in ticket #2007):
Coverity CID 1668: Plug memory leak when malloc() failed.:55 2009

May 11 18:33:30 2009 - editline.3 el.c histedit.h
restore binary compatibility by providing new prompt functions that take
an extra literal character.

May 19 21:45:14 2009 - refresh.c
always scroll when we advance past bottom. From Caleb Welton
cwelton at greenplum dot com.

Jul 17 12:27:57 2009 - term.c
- off by one in the term.h case.
- make code more similar to tcsh (if we want to handle wide chars, this is
  needed; for now it is a no-op)

Jul 22 15:56:29 2009 - el.c
Move filename to the scope it is being used.
From Michael Cook mcook at bbn dot com

Jul 22 15:57:00 2009 - read.c
Always initialize nread since it is an out param.
From Michael Cook mcook at bbn dot com

Jul 22 18:25:26 2009 - el.c
Only need path if we have issetugid... From Anon Ymous

Jul 25 21:19:23 2009 - el.c
Ignore comment lines in .editrc from Jess Thrysoee

Sep 7 21:24:33 2009
histedit.h history.c readline.c
apply apple patches from:
http://opensource.apple.com/source/libedit/libedit-11/patches/

Dec 28 21:52:43 2009 - refresh.c
Fix bug where tab completion on the second or > line that caused listing
ended up corrupting the display by an extra space in the beginning. Reported
by Mac Chan.

Dec 28 22:15:36 2009 - refresh.c term.c
reduce diff with tcsh

Obtained from:	NetBSD
Tested by:	bapt, jilles and current@
MFC after:	1 week
2012-06-22 18:01:22 +00:00
Alexander Motin
84c4de2d47 Don't print SCSI Queue Full and CAM_REQUEUE_REQ statuses as errors if they
were handled and retried. They are part of normal operation for SCSI TCQ.

MFC after:	3 days
2012-06-22 16:20:13 +00:00
Konstantin Belousov
a30facd9c7 Commit changes missed from r237435. Properly calculate the signal
trampoline addresses after the shared page is enabled.  Handle FreeBSD
ABIs without shared page support too.

Reported and tested by:	David Wolfskill <david catwhisker org>
	 (previous version)
Pointy hat to: kib
MFC after:   1 month
2012-06-22 16:05:56 +00:00
Navdeep Parhar
afce448c1a Do not read registers with read side effects while performing a register
dump for cxgbetool.
2012-06-22 08:37:33 +00:00
Navdeep Parhar
2a5f6b0e65 cxgbe(4): update to firmware interface 1.5.2.0; updates to shared code. 2012-06-22 07:51:15 +00:00
Konstantin Belousov
d69ae4126b Enable shared page on i386, now it has a use for vdso_timehands.
MFC after:	1 month
2012-06-22 07:16:29 +00:00
Konstantin Belousov
869fd80fd4 Use struct vdso_timehands data to implement fast gettimeofday(2) and
clock_gettime(2) functions if supported. The speedup seen in
microbenchmarks is in range 4x-7x depending on the hardware.

Only amd64 and i386 architectures are supported. Libc uses rdtsc and
kernel data to calculate current time, if enabled by kernel.

Hopefully, this code is going to migrate into vdso in some future.

Discussed with:	bde
Reviewed by:	jhb
Tested by:	flo
MFC after:	1 month
2012-06-22 07:13:30 +00:00
Konstantin Belousov
aea810386d Implement mechanism to export some kernel timekeeping data to
usermode, using shared page.  The structures and functions have vdso
prefix, to indicate the intended location of the code in some future.

The versioned per-algorithm data is exported in the format of struct
vdso_timehands, which mostly repeats the content of in-kernel struct
timehands. Usermode reading of the structure can be lockless.
Compatibility export for 32bit processes on 64bit host is also
provided. Kernel also provides usermode with indication about
currently used timecounter, so that libc can fall back to syscall if
configured timecounter is unknown to usermode code.

The shared data updates are initiated both from the tc_windup(), where
a fast task is queued to do the update, and from sysctl handlers which
change timecounter. A manual override switch
kern.timecounter.fast_gettime allows to turn off the mechanism.

Only x86 architectures export the real algorithm data, and there, only
for tsc timecounter. HPET counters page could be exported as well, but
I prefer to not further glue the kernel and libc ABI there until
proper vdso-based solution is developed.

Minimal stubs neccessary for non-x86 architectures to still compile
are provided.

Discussed with:	bde
Reviewed by:	jhb
Tested by:	flo
MFC after:	1 month
2012-06-22 07:06:40 +00:00
Warner Losh
5af29dd303 Fix a stray debug that I committed accidentally years ago... 2012-06-22 06:44:22 +00:00
Konstantin Belousov
a9d8437c6d Enchance the shared page chunk allocator.
Do not rely on the busy state of the page from which we allocate the
chunk, to protect allocator state. Use statically allocated sx lock
instead.

Provide more flexible KPI. In particular, allow to allocate chunk
without providing initial data, and allow writes into existing
allocation. Allow to get an sf buf which temporary maps the chunk, to
allow sequential updates to shared page content without unmapping in
between.

Reviewed by:	jhb
Tested by:	flo
MFC after:	1 month
2012-06-22 06:39:28 +00:00
Konstantin Belousov
232aa31fb9 Reserve AT_TIMEKEEP auxv entry for providing usermode the pointer to
timekeeping information.

MFC after:  1 week
2012-06-22 06:38:31 +00:00
Warner Losh
2403db9a0f Move these #defines to at91reg.h (where I should have put them in the
first place).
2012-06-22 05:54:34 +00:00