dragonfly.git
14 years agoAHCI - Add Port Multiplier HOTPLUG support
Matthew Dillon [Fri, 12 Jun 2009 06:10:06 +0000 (23:10 -0700)]
AHCI - Add Port Multiplier HOTPLUG support

* Add a ton of infrastructure to the port multiplier module.  We now probe
  the PM capabilities and turn on asynchronous notification if it supports
  it.

  Upon reception of an async notification event we access the PM to
  determine which targets may have changed state, then rescan those
  targets.

* Add code to handle transient IFS failures when issuing a PM softreset
  command.

* Significantly rework the CAM infrastructure such that most of the hard
  work now occurs from a main context instead of from an interrupt context.

* Replace all DELAY()'s with ahci_os_sleep(), and use tsleep().

* Use milliseconds as a universal time-base.

* Do not initiate a timeout until a CCB is actually sent to the
  chip.

* Improve the device probe and state machine (it still needs work though).

14 years agoCAM - Silence console spew on bus-rescan
Matthew Dillon [Fri, 12 Jun 2009 06:07:20 +0000 (23:07 -0700)]
CAM - Silence console spew on bus-rescan

Silence the console spew that occurs when rescanning a SCSI bus.  This
is primarily so the AHCI driver can just have CAM re-test all the targets
when new targets are added or deleted.

14 years agonrelease: don't mkdir bootstrap workdir
Simon Schubert [Thu, 11 Jun 2009 23:51:33 +0000 (01:51 +0200)]
nrelease: don't mkdir bootstrap workdir

The newer pkgsrc bootstraps don't seem to like it when their
workdir already exist, so simply don't create it.

14 years agoAHCI - Try to salvage port on PM target failure.
Matthew Dillon [Thu, 11 Jun 2009 08:30:38 +0000 (01:30 -0700)]
AHCI - Try to salvage port on PM target failure.

* If a PM target times out disable it, but try to salvage the rest of
  the port so other PM targets continue to operate.  We do this by
  stopping the port, issuing a CLO, and then restarting it to clear
  the BSY condition, then re-issue whatever commands might have been
  active (probably none if this is a PM since we are restricted to
  one command at a time).

14 years agoAHCI - DHRS interrupt does not stop command processing.
Matthew Dillon [Thu, 11 Jun 2009 07:49:48 +0000 (00:49 -0700)]
AHCI - DHRS interrupt does not stop command processing.

Not only does the DHRS interrupt not stop command processing (which means
that ahci_pm_read() needs to be single-threaded by the way, which we only do
by happenstance atm), but we were stopping and starting the port without
reloading commands in-progress.

14 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Matthew Dillon [Thu, 11 Jun 2009 06:41:04 +0000 (23:41 -0700)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

14 years agoAHCI - Initial Port Multiplier support + misc fixes, and major reorg.
Matthew Dillon [Thu, 11 Jun 2009 06:24:06 +0000 (23:24 -0700)]
AHCI - Initial Port Multiplier support + misc fixes, and major reorg.

* Add nearly all of the core port multiplier support code.  Add a
  new module, ahci_pm.c, which has most of the PM support.  Note
  that the PM probe code (ahci_port_pmprobe()) was placed in ahci.c.

  Note that we have to reduce the number of commands in the queue to 1
  even though we are in command switched mode, which is contrary to the
  AHCI spec which says we can queue more then 1 (the HBA still serializes
  it).  However, when I try to queue more then one to different devices
  the SATA port gets fatal PHY errors.

* Significantly reorganize the hard and soft reset code and create
  additional procedures in ahci_pm.c for hard and soft resets of
  targets through the PM.

  The softreset code now does the reset sequence twice to try to work
  around an issue where a previous signature prevents the new signature
  from being properly latched.

  The hard and soft reset code and the CAM code now has a simple probe
  sequencer using ap->ap_probe (and at->at_probe for the PM ata_port
  structures).

* The hardreset code now interfaces with the PM probe code, which itself
  is a bit complex.  Ports with port multipliers on them can either busy
  out on the initial probe or return information related to the device
  at target 0 instead of information related to the PM itself, so we
  have to probe the PM by putting the port into PMA mode and doing a
  softreset of target 15 even if a PM does not appear to be attached.

* The hard and soft reset code for a target behind a PM (in ahci_pm.c)
  tries to be careful not to break the entire port (and thus all the
  targets) when one target misbehaves.

* Get a large chunk of the error handling code working with the PM,
  including hopefully partial cancelation on target failure to fail
  just that target instead of the entire SATA port.

* Modify the probe code to check for the presence of a PHY with a short
  polling interval and skip the port if nothing appears to be connected
  to it.

* Fix re-initialization recursions which can occur from the port interrupt
  handler when called during a software or hardware reset.

* ATA_PORT vs AHCI_PORT

  AHCI_PORT represents a physical port on the AHCI device.  ATA_PORT
  reprewents a logical port of which (if a PM is present) there can be
  up to 16 per physical port.  In most cases in the code we only pass
  ATA_PORT (variable name 'atx') for targets behind a port multiplier
  and we pass NULL for atx for directly connected targets.  The variable
  'at' is similar to 'atx' except it is always non-NULL and is a
  pointer to target 0 on non-PM SATA ports (and the same as atx on
  PM SATA ports).

* Reorganize tracking of ap->ap_active_cnt, tying it more directly to
  the manipulation of ap->ap_active.  This also fixed a few bugs in
  the tracking of ap->ap_active_cnt.

* Implement the DHRS (Device-to-Host FIS) interrupt and properly
  copy the rfis to the ccb.  It is unclear whether command processing
  stops when we receive DHRS but if it does we restart it.  Without
  this the PM register read and write functions do not work.

* Add interrupt code to track notification (SSNTF capability) via
  the SDBS interrupt and AHCI_PREG_SNTF.  Not tied into anything yet.

* Put all the bits for the AHCI_PREG_SERR register on the same plane,
  combining the DIAG and ERR bits.  Get rid of the shift-by-16 macros.

* Pray.

14 years agoMake openssl define OPENSSL_NO_IDEA if compiled without IDEA support.
Hasso Tepper [Wed, 10 Jun 2009 06:13:53 +0000 (09:13 +0300)]
Make openssl define OPENSSL_NO_IDEA if compiled without IDEA support.

14 years agomount(8): Add an 'ignore' option.
Sascha Wildner [Wed, 10 Jun 2009 17:09:29 +0000 (19:09 +0200)]
mount(8): Add an 'ignore' option.

The actual infrustructure was already in place (MNT_IGNORE) but it
couldn't be set, i.e. df(1) already had code to ignore MNT_IGNORE
mounts and an option to also show ignored mounts (-a), but the user
couldn't set the ignored option.

This is useful for procfs, amd, nullfs, filebacked fs, etc.
To test it with procfs you also need to recompile mount_std(8).

Some systems call the option 'hidden', but it doesn't seem any better
(both aren't very good), but at least 'ignore' corresponds to
MNT_IGNORE.

Submitted-by: Andreas Hauser <andy@splashground.de>
Dragonfly-bug: <http://bugs.dragonflybsd.org/issue200>

14 years agonrelease: Tar the src tarballs for the CD/DVD from the root of the src tree.
Sascha Wildner [Wed, 10 Jun 2009 16:37:28 +0000 (18:37 +0200)]
nrelease: Tar the src tarballs for the CD/DVD from the root of the src tree.

...and not from the root's parent directory.

This fixes the corner case of building an ISO in a source tree which
resides in a directory that is not named "src".

Reported-by: Antonio Huete Jimenez <ahuete.devel@gmail.com>
Submitted-by: corecode
14 years agoposix_spawn.3: Sort by section number, then alphabetically.
Sascha Wildner [Wed, 10 Jun 2009 13:24:38 +0000 (15:24 +0200)]
posix_spawn.3: Sort by section number, then alphabetically.

14 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Matthew Dillon [Tue, 9 Jun 2009 18:54:40 +0000 (11:54 -0700)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

14 years agoAHCI - Better reset sequencing, bug fixes
Matthew Dillon [Tue, 9 Jun 2009 18:47:54 +0000 (11:47 -0700)]
AHCI - Better reset sequencing, bug fixes

* Change the reset sequence.  If the first hardreset fails do a second
  hardreset.  If that fails then try doing a softreset.  This seems to
  catch all the cases.  It is unclear why the reset sequence fails at
  random points but it seems to be a combination of the port command
  processor state and the device state.  COMRESET does not actually reset
  everything like its supposed to.

* Temporarily set ap_state to AP_S_NORMAL when starting a reset
  sequence so commands do not just fail due to a previously failed
  condition on the port.

* Restoration of command register state now depends on whether the
  reset succeeded or failed.

* Note that only SERR_DIAG_X needs to be cleared to allow for the
  next TFD update.  These updates are serialized by the controller
  and there may be more then one.  Add a function ahci_flush_tfd() which
  flushes all of them.

* Add ahci_port_hardstop() for dealing with failed ports and device
  removals, instead of using ahci_port_hardreset().  This function
  tries to do multiple transitions via section 10.10.1.  These
  transitions are not well documented by the standard.

* Fix ahci_poll() to not queue a command if the port is in a failed
  state, as this really messes up our port processing state machine.

14 years agoRemove mp_capable; mp_enable() uses cpu_apic_address.
Sepherosa Ziehau [Tue, 9 Jun 2009 13:48:14 +0000 (21:48 +0800)]
Remove mp_capable; mp_enable() uses cpu_apic_address.

14 years agoDefer LAPIC mapping from pmap_bootstrap() to mp_enable()
Sepherosa Ziehau [Tue, 9 Jun 2009 11:47:58 +0000 (19:47 +0800)]
Defer LAPIC mapping from pmap_bootstrap() to mp_enable()

Discussed-with: dillon@

14 years agoAHCI - Add some small delays in the reset sequence.
Matthew Dillon [Tue, 9 Jun 2009 09:42:49 +0000 (02:42 -0700)]
AHCI - Add some small delays in the reset sequence.

* Add a small delay after sending the RESET FIS in softreset before
  sending the second FIS.

* Add a small delay after the device succesfully unbusies before starting
  normal commands.

14 years agoAHCI - Improve hot-plug sequencing.
Matthew Dillon [Tue, 9 Jun 2009 09:30:21 +0000 (02:30 -0700)]
AHCI - Improve hot-plug sequencing.

* Properly either fail or restart outstanding commands when we get a PCS
  interrupt, based on the event we determined to have occurred.

  NOTE: A PCS event stops command processing, so at the very least command
  processing must be restarted by cycling the port.

* Reset the port's ap->ap_state when a hotplug-insertion is detected, so
  the port has a chance to get out of its failed state.

14 years agoAHCI bug fixes & enhancements. port_init, port_stop, port_start, etc.
Matthew Dillon [Tue, 9 Jun 2009 08:50:36 +0000 (01:50 -0700)]
AHCI bug fixes & enhancements.  port_init, port_stop, port_start, etc.

* When initializing the AHCI device do an unconditional reset instead of
  a conditional reset.  The previous conditional reset did not cover
  all the bases and could result in an unusable device.

* Remove the second (unused) argument from ahci_port_start().

* ahci_port_init()  - init/reinit common code.  If the hard reset
  fails try a second time before giving up.  Devices can get into
  weird states and two attempts seems to clear it up.

* ahci_port_start() - FRE must be turned on before ST.   Wait for FR
  to come up before turning on ST.  The spec does not require this but
  it saves us from a race in ahci_port_stop() so do it anyway.

* ahci_port_stop() - When turning off ST we must wait for CR to go
  inactive before we can turn off FRE.

* ahci_port_free() - Properly sequence stopping of the port by calling
  ahci_port_stop().

* Create a consolidated ahci_port_reset() call to clean up some of the
  code paths.

14 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Matthew Dillon [Mon, 8 Jun 2009 23:10:51 +0000 (16:10 -0700)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

14 years agovmstat enhancements - Fall-back to kilobytes and megabytes if field too wide
Matthew Dillon [Mon, 8 Jun 2009 23:09:04 +0000 (16:09 -0700)]
vmstat enhancements - Fall-back to kilobytes and megabytes if field too wide

If a numeric field is too wide divide and output in kilobytes or megabytes
(megabytes or gigabytes for VM page statistics).

14 years agoProperly protect kernel structures in varsym.h
Aggelos Economopoulos [Mon, 8 Jun 2009 22:48:46 +0000 (01:48 +0300)]
Properly protect kernel structures in varsym.h

Noticed-by: Antonio Huete Himenez, dillon@, aggelos@
Tested-by: dillon@
14 years agoCorrect missing 'STD' clause in entries for syscalls.master 450-452
Matthew Dillon [Mon, 8 Jun 2009 22:24:44 +0000 (15:24 -0700)]
Correct missing 'STD' clause in entries for syscalls.master 450-452

14 years agoUSB - Properly handle the 'wait' flag when getting a char from the keyboard
Matthew Dillon [Mon, 8 Jun 2009 19:36:03 +0000 (12:36 -0700)]
USB - Properly handle the 'wait' flag when getting a char from the keyboard

This fixes numerous issues with DDB and panic dumps when a USB keyboard
is attached.

14 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Matthew Dillon [Mon, 8 Jun 2009 19:35:44 +0000 (12:35 -0700)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

14 years agoDDB - Do not generate endless stream of CRs if console not attached
Matthew Dillon [Mon, 8 Jun 2009 19:31:44 +0000 (12:31 -0700)]
DDB - Do not generate endless stream of CRs if console not attached

If we get a console EOF do not just generate an endless stream of
CR's.  Just hang in the loop for now.

14 years agoUSB - Add support for xfer-restart-before-callback
Matthew Dillon [Mon, 8 Jun 2009 18:49:05 +0000 (11:49 -0700)]
USB - Add support for xfer-restart-before-callback

Interrupt pipes restart their xfers.  When used for a USB
keyboard the xfer must be restarted before the callback,
even though there may be state data races, otherwise
the CTL-ALT-ESC sequence into the debugger will leave
the xfer unqueued and the keyboard will stop working.

14 years agoUSB - Fix polling code
Matthew Dillon [Mon, 8 Jun 2009 18:46:43 +0000 (11:46 -0700)]
USB - Fix polling code

The polling code now calls the intr function instead of trying
to optimize/shortcut the pending-interrupt test.  There are
additional conditions which need action which the test was
not covering.

The polling code now calls the softintr function as well,
as it may be non-operational when the polling code
is being used.

14 years agoMerge branch 'master' of /home/aggelos/devel/dfly/dfly.git/
Aggelos Economopoulos [Mon, 8 Jun 2009 14:54:38 +0000 (17:54 +0300)]
Merge branch 'master' of /home/aggelos/devel/dfly/dfly.git/

14 years agolock around accesses to uidinfo and varsymset
Aggelos Economopoulos [Mon, 8 Jun 2009 14:42:46 +0000 (17:42 +0300)]
lock around accesses to uidinfo and varsymset

- add ->vx_lock to protect the varsymset fields
- add ->ui_lock to protect the rest of the fields in uidinfo
- protect the uidinfo hash
- the varsym*() syscalls are now mpsafe

This is obviously performance-irrelevant, but it allows
access to uidinfo without the BGL.

14 years agoSync zoneinfo database with tzdata2009i from elsie.
Sascha Wildner [Mon, 8 Jun 2009 13:43:03 +0000 (15:43 +0200)]
Sync zoneinfo database with tzdata2009i from elsie.

asia:           8.32 -> 8.34

Bangladesh will introduce DST starting June 20.

14 years agorc.sendmail(8): Fix typo.
Sascha Wildner [Sun, 7 Jun 2009 04:06:05 +0000 (06:06 +0200)]
rc.sendmail(8): Fix typo.

14 years agolocaltime(3): Silence the last i386 warning in libc.
Sascha Wildner [Sat, 6 Jun 2009 13:08:38 +0000 (15:08 +0200)]
localtime(3): Silence the last i386 warning in libc.

Taken-from: FreeBSD

14 years agorpc.rquotad(8): Remove bogus #include <varargs.h>.
Sascha Wildner [Sat, 6 Jun 2009 12:56:12 +0000 (14:56 +0200)]
rpc.rquotad(8): Remove bogus #include <varargs.h>.

14 years agoAHCI - Fix a polled command issue.
Matthew Dillon [Sun, 7 Jun 2009 19:42:30 +0000 (12:42 -0700)]
AHCI - Fix a polled command issue.

* If ATA_F_POLL is set, the timeout code may be called without
  ATA_F_TIMEOUT_RUNNING having been set.

* NOTE on previous commit:  The ahci_poll() code also had to be made
  more robust to handle ATA_F_POLL general requests (such as when dealing
  with a crash dump).  Such requests can wind up in a more diverse set
  of states then polled requests made from the softreset code.

14 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Matthew Dillon [Sun, 7 Jun 2009 19:39:13 +0000 (12:39 -0700)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

14 years agoAHCI - properly initialize ccb_xa.flags in softreset, make poll code robust
Matthew Dillon [Sun, 7 Jun 2009 19:36:35 +0000 (12:36 -0700)]
AHCI - properly initialize ccb_xa.flags in softreset, make poll code robust

* The softreset code did not properly initialize ccb_xa.flags, causing
  the softreset FIS's to sometimes get queued as an NCQ command instead of
  as a non-NCQ command.

* Make ahci_poll() a bit more robust.  Properly set ccb_xa.state on
  timeout, check for unexpected completions, and check to see if the
  ccb was put on a queue (though the latter should never happen since
  active/sactive is cleared by ahci_get_err_ccb()).

14 years agos/pkgbox/avalon/g for nrelease, pkg_radd, pkg_search. Plus pkg_radd fixes.
Justin C. Sherrill [Sun, 7 Jun 2009 17:51:04 +0000 (10:51 -0700)]
s/pkgbox/avalon/g for nrelease, pkg_radd, pkg_search.  Plus pkg_radd fixes.

pkg_radd had a BINPKG_SITES default that wouldn't have worked.

14 years agoACPI P-State: Using priority messages
Sepherosa Ziehau [Sun, 7 Jun 2009 06:25:54 +0000 (14:25 +0800)]
ACPI P-State: Using priority messages

14 years agoicmp: Bring in reply_src and reply_from_interface sysctl nodes.
Sepherosa Ziehau [Sun, 7 Jun 2009 06:04:03 +0000 (14:04 +0800)]
icmp: Bring in reply_src and reply_from_interface sysctl nodes.

They act as fallback mechanism if proper inet address could not
be found on the packet incoming interface.

reply_from_interface:
    icmp reply from incoming interface for non-local packets
reply_src:
    icmp reply source for non-local packets

Obtained-from: FreeBSD

14 years agoroute_output: Fix RTM_DELETE rtentry leakage
Sepherosa Ziehau [Sun, 7 Jun 2009 01:21:09 +0000 (09:21 +0800)]
route_output: Fix RTM_DELETE rtentry leakage

This actually incorporates two dependent changes.
- Change to routing code:
  Keep the rtinfo in the netmsg unchanged, so all CPU on the ntemsg
  forwarding path will see the same rtinfo setup by rtrequest1_global()
  or rtsearch_global()'s caller, instead of the rtinfo baked by the
  previous CPU.
  This is critical step before we could free the rtentry in route_output()
  RTM_DELETE callback, since in this callback, fillrtmsg() will change
  the rtinfo to point the current rtentry's memory.  As long as we feed
  it a rtinfo local copy, we are safe to free the rtentry later, no
  dangling memory reference anymore.
- Change to the rtsock code:
  Since the rtinfo setup in the route_output() points to the memory in
  the preallocated rtm, so we could not allow the callback of
  rtrequset1_global()/ rtsearch_global() to free the rtm if reallocation
  is required due to the rtm size changes.  We keep two different pointer
  fields in the callback argument now.  One is the save the preallocated
  rtm, which is pointed to by the rtinfo.  It could be freed only after
  a new rtm is allocated and rtrequset1_global()/ rtsearch_global() are
  done, so rtinfo will not reference invalid memory.  The other pointer
  saves the new rtm if there is any.

Comments are added to the related places.

Reported-by: ruse39 on EFnet
14 years agoroute_output: Correctly set family according to the rtinfo.rti_dst
Sepherosa Ziehau [Sat, 6 Jun 2009 11:03:18 +0000 (19:03 +0800)]
route_output: Correctly set family according to the rtinfo.rti_dst

Mainly to
- Avoid referencing rtinfo after rtrequest1_global/rtsearch_global;
  this will ease upcoming fixes.
- Eliminate bunch of rtinfo.rti_dst NULL assignments.

14 years agoUSB - umass - fix reentrancy issues when rescanning the bus.
Matthew Dillon [Sun, 7 Jun 2009 00:55:16 +0000 (17:55 -0700)]
USB - umass - fix reentrancy issues when rescanning the bus.

Use an asynchronous rescan instead of a synchronous rescan to avoid
reentrancy issues.

14 years agoAHCI - Implement ahci_xpt_poll() - fix livelock during shutdown/reboot/panic
Matthew Dillon [Sun, 7 Jun 2009 00:32:45 +0000 (17:32 -0700)]
AHCI - Implement ahci_xpt_poll() - fix livelock during shutdown/reboot/panic

The ahci_xpt_poll() function is called when interrupts might be
non-operational, typically during a shutdown/reboot, or panic.

Poll the appropriate AHCI port.

14 years agoAHCI - Hotplug. Increase timeout for BSY check, FIS adjusts for softreset, CAM
Matthew Dillon [Sat, 6 Jun 2009 22:45:14 +0000 (15:45 -0700)]
AHCI - Hotplug.  Increase timeout for BSY check, FIS adjusts for softreset, CAM

* Wait up to 3 seconds for BSY to clear.  1 second was not enough when
  powering up an external 2.5" drive already connected to the port.

* It is unclear how other fields in the FIS should be initialized when
  performing a soft reset.  Zero the fields instead of inheriting whatever
  junk was in the FIS from prior commands.  This seems to fix random
  errors from unplugging and plugging in a "My Book".

* Adjust the CAM devq to ensure that one ata_xfer remains available for error
  processing.  Do not clean out the devq when reducing the number of tags to
  1 as we will not use NCQ in this case anyway and need the extra CCB for
  error processing.

14 years agosystat - fix bug in vmmeter when switching to it via ':pv'.
Matthew Dillon [Sat, 6 Jun 2009 21:22:30 +0000 (14:22 -0700)]
systat - fix bug in vmmeter when switching to it via ':pv'.

If systat is started with something and then switched to vmmeter via ':pv'
vmmeter failed to display.  Fixing the return value for the init function
solves the problem.

14 years agovmstat - Add another byte of width for Csw, Trp, Sys, Int, and Flt.
Matthew Dillon [Sat, 6 Jun 2009 21:01:53 +0000 (14:01 -0700)]
vmstat - Add another byte of width for Csw, Trp, Sys, Int, and Flt.

Reorganize the Proc: and csw/trp/sys/int/sof/flt line a bit to make them
a bit wider so they are less likely to squeeze together without any
separation on heavily loaded systems.

14 years agoAdd the AHCI driver to the kernel module build subsystem and to LINT
Matthew Dillon [Sat, 6 Jun 2009 18:36:48 +0000 (11:36 -0700)]
Add the AHCI driver to the kernel module build subsystem and to LINT

14 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Matthew Dillon [Sat, 6 Jun 2009 17:52:01 +0000 (10:52 -0700)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

14 years agoAHCI - Hot Plug support, ATAPI IDENTIFY, CAM bus scan issues, etc
Matthew Dillon [Sat, 6 Jun 2009 17:44:31 +0000 (10:44 -0700)]
AHCI - Hot Plug support, ATAPI IDENTIFY, CAM bus scan issues, etc

* Split some code out of ahci_port_alloc() into its own procedure,
  ahci_port_init().  This procedure will be used to init/reinit a
  port for Hot-Plug.

* Do not free ports which have device problems, hot-plug can still
  operate on such ports.

* Re-detect ap_type when resetting a port.  Create a helper routine
  called ahci_port_signature_detect() to reduce code duplication.

* Augment ahci_cam_changed() so hot-plug can tell it whether a device
  is being added or removed.

* Scan the CAM bus asynchronously to fix reentrancy issues.

* Consolidate most of the ATAPI and DISK probe code back into one routine.

  Use ATA_C_ATAPI_IDENTIFY when probing an ATAPI device and also probe
  for NCQ on ATAPI devices (though nobody knows if it would actually work
  if an ATAPI device said it could do it).

* Do not try to set the security freeze-lock if the identify info
  indicates that the freeze-lock is already active.  This fixes a
  command timeout that occurs when re-plugging devices whos freeze-lock
  remains intact from a previous use.

* Add defines for ATA_C_ATAPI_IDENTIFY and ATA_SECURE_* identify bits.

14 years agocontrib/tcp_wrappers: Fix fix_options()'s return type.
Sascha Wildner [Sat, 6 Jun 2009 10:36:30 +0000 (12:36 +0200)]
contrib/tcp_wrappers: Fix fix_options()'s return type.

This helps building with clang.

Submitted-by: Alex Hornung <ahornung@gmail.com>
14 years agoACPI P-State CPU driver: shorten function name
Sepherosa Ziehau [Sat, 6 Jun 2009 06:56:49 +0000 (14:56 +0800)]
ACPI P-State CPU driver: shorten function name

14 years agoACPI P-State support step 2/2: Add CPU driver for AMD 0fh family processors
Sepherosa Ziehau [Sat, 6 Jun 2009 06:47:48 +0000 (14:47 +0800)]
ACPI P-State support step 2/2: Add CPU driver for AMD 0fh family processors

amd0f_set_fidvid() is implemented based on the patch submitted by
Alexander Polakov <polachok@gmail.com>; the patch itself is obtained
from NetBSD/OpenBSD.

The first phrase of P-State transition is rewrote according to "the BIOS and
Kernel Developer's Guide for AMD NPT Family 0Fh Processors, Rev.3.08" (#32559)

14 years agoAHCI - Normalize console reporting of the port scan to make it easier to read.
Matthew Dillon [Sat, 6 Jun 2009 05:14:36 +0000 (22:14 -0700)]
AHCI - Normalize console reporting of the port scan to make it easier to read.

14 years agoAHCI - Add conditional logic for wcache and rahead, enhanced reporting, fixes
Matthew Dillon [Sat, 6 Jun 2009 05:11:38 +0000 (22:11 -0700)]
AHCI - Add conditional logic for wcache and rahead, enhanced reporting, fixes

* Do not enable the write cache if the ident info says it is already enabled.

* Do not enable read-ahead if the ident info says it is already enabled.

* Do not try to set the freeze lock if the security feature is not supported.

* Enhanced error reporting.

* Report wcache and rahead state in the Ident.

NOTE: "WD My Book" ESATA consumer devices generate a fatal interface error
      when presented with ATA_C_SET_FEATURES.  The above code will quietly
      work around the problem.  The bug is likely in the My Book daughter
      board.

14 years agoAHCI - Add conditional logic for wcache and rahead, enhanced reporting, fixes
Matthew Dillon [Sat, 6 Jun 2009 04:57:19 +0000 (21:57 -0700)]
AHCI - Add conditional logic for wcache and rahead, enhanced reporting, fixes

* Do not enable the write cache if the ident info says it is already enabled.

* Do not enable read-ahead if the ident info says it is already enabled.

* Enhanced error reporting.

* Report wcache and rahead state in the Ident.

NOTE: "WD My Book" ESATA consumer devices generate a fatal interface error
      when presented with ATA_C_SET_FEATURES.  The above code will quietly
      work around the problem.  The bug is likely in the My Book daughter
      board.

14 years agoAHCI - Hook up sense information from rfis for ATAPI commands
Matthew Dillon [Sat, 6 Jun 2009 00:59:10 +0000 (17:59 -0700)]
AHCI - Hook up sense information from rfis for ATAPI commands

Hook-in the sense data returned from the rfis by translating it to
the autosense data structure in CAM CCB.

14 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Matthew Dillon [Fri, 5 Jun 2009 20:45:16 +0000 (13:45 -0700)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

14 years agoFix amd64 build and UP build issues with recent commit.
Matthew Dillon [Fri, 5 Jun 2009 20:44:30 +0000 (13:44 -0700)]
Fix amd64 build and UP build issues with recent commit.

Fix some build issues and sync amd64 with i386.

Reported-by: Jordan Gordeev <jgordeev@dir.bg>
14 years agokdump(1): Fix add hoc translation for setpriority.
Stathis Kamperis [Fri, 5 Jun 2009 20:25:07 +0000 (23:25 +0300)]
kdump(1): Fix add hoc translation for setpriority.

kdump was translating the wrong argument (third instead of first).

Before patch:  CALL  setpriority(0,0x2bc3,<invalid=10>)
After  patch:  CALL  setpriority(PRIO_PROCESS,0x2bc3,0xa)

14 years agoscsi_read_capacity_data_long -> scsi_read_capacity_data_16
Matthew Dillon [Fri, 5 Jun 2009 16:29:01 +0000 (09:29 -0700)]
scsi_read_capacity_data_long -> scsi_read_capacity_data_16

Reported-by: "Simon 'corecode' Schubert" <corecode@fs.ei.tum.de>
14 years agoAHCI Driver - add initial ATAPI support, suppy fake SENSE for DISK support.
Matthew Dillon [Fri, 5 Jun 2009 05:37:24 +0000 (22:37 -0700)]
AHCI Driver - add initial ATAPI support, suppy fake SENSE for DISK support.

Implement basic ATAPI probe and SCSI pass-through.  ATAPI differs from DISK
in that all commands are packetized and follow the SCSI standard for the most
part.

ATAPI does not follow the SCSI standard precisely.  Many ATAPI implementations
just can't handle READ_6, WRITE_6, or modern INQUIRY commands.  To deal with
this the following conversions are done by the layer:

READ_6 -> READ_10

WRITE_6 -> WRITE_10

INQUIRY -> truncate length field to SHORT_INQUIRY_LENGTH and
   clear the SI_EVPD bit in the byte2 field if the
   page_code being requested is 0 (basic inquiry).

Continue to work on the DISK support.  If an error occurs fake AUTOSENSE
data is constructed (is there a way to obtain real sense data?).

14 years agoAHCI Driver port from OpenBSD to DragonFly - Initial commit
Matthew Dillon [Thu, 4 Jun 2009 18:21:05 +0000 (11:21 -0700)]
AHCI Driver port from OpenBSD to DragonFly - Initial commit

This is the initial work synchronization commit for the AHCI driver port.
About 85% of the logic is now working.

This also includes initial wiring of interrupt bits and status tests for
hot-plug support.

14 years agoAdd prototype for bus_dma_tag_getmaxsize().
Matthew Dillon [Thu, 4 Jun 2009 18:13:09 +0000 (11:13 -0700)]
Add prototype for bus_dma_tag_getmaxsize().

14 years agoAdd definition for ATAPI_READ_CAPACITY_16 (same as ATAPI_SERVICE_ACTION_IN)
Matthew Dillon [Thu, 4 Jun 2009 18:12:48 +0000 (11:12 -0700)]
Add definition for ATAPI_READ_CAPACITY_16 (same as ATAPI_SERVICE_ACTION_IN)

14 years agobus_dma_tag fixes and enhancements.
Matthew Dillon [Thu, 4 Jun 2009 18:10:20 +0000 (11:10 -0700)]
bus_dma_tag fixes and enhancements.

* Protect the cached segment list in the bus_dma_tag structure
  with a spinlock.

* Cache up to 8 segments on the stack when applicable (needs more work).

* Add function call bus_dma_tag_getmaxsize() to access the maxsize field
  in the tag.

* Fix a bug in bus_dmamap_load_uio() which did not properly append segments
  when the uio has more then one iov.  (untested).

14 years agoMinor string description changes to match READ_CAPACITY_16
Matthew Dillon [Thu, 4 Jun 2009 18:08:51 +0000 (11:08 -0700)]
Minor string description changes to match READ_CAPACITY_16

14 years agoAdd typedefs for pci register integral types, taken from OpenBSD.
Matthew Dillon [Thu, 4 Jun 2009 18:08:02 +0000 (11:08 -0700)]
Add typedefs for pci register integral types, taken from OpenBSD.

14 years agoAdd entries to pcidevs for AHCI products and regenerate.
Matthew Dillon [Thu, 4 Jun 2009 18:07:38 +0000 (11:07 -0700)]
Add entries to pcidevs for AHCI products and regenerate.

14 years agoCAM Enhancements for AHCI driver work, import some structures from OpenBSD.
Matthew Dillon [Thu, 4 Jun 2009 18:02:52 +0000 (11:02 -0700)]
CAM Enhancements for AHCI driver work, import some structures from OpenBSD.

Add a CAM bit in the ccb to indicate that a polled operation is being
requested.  This is easier for the driver to find then putting it in
the periph structure.

Rename the scsi_read_capacity_data_long structure to
scsi_read_capacity_data_16 to match OpenBSD, and add a
command code for READ_CAPACITY_16 to match OpenBSD and reduce
confusion.  Also add missing fields to scsi_read_capacity_data_16.

Add SCSI_REV_SPC3.  Taken from OpenBSD.

Add a page description structure for UNIT_DEVID (page 0x83), taken from
OpenBSD.

Add unions for SCSI CDB command structures and response fields to improve
code readability.

14 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Matthew Dillon [Thu, 4 Jun 2009 17:58:56 +0000 (10:58 -0700)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

14 years agoACPI P-State support step 1.5/2: Add CPU driver for AMD 10h family processors
Sepherosa Ziehau [Wed, 3 Jun 2009 12:54:48 +0000 (20:54 +0800)]
ACPI P-State support step 1.5/2: Add CPU driver for AMD 10h family processors

14 years agoCAM fixes - queue empty tests, sim refcount, add XPORT_AHCI enum.
Matthew Dillon [Wed, 3 Jun 2009 03:36:27 +0000 (20:36 -0700)]
CAM fixes - queue empty tests, sim refcount, add XPORT_AHCI enum.

* CAMQ_GET_HEAD assumes the head entry in the devq array is NULL to
  indicate an empty queue.  Fix allocations and removal code to ensure
  that no bogus pointers are left in the array, cleaning it up and fixing
  a bug where CAMQ_GET_HEAD() could return non-NULL even when the queue
  was empty.

  This fixes numerous reports on detachment of non-empty device queues
  that are, in fact, empty, and also fixes a memory leak.

* xpt_bus_register() bumps the sim's refcount, but xpt_bus_deregister()
  did not properly release it.  This fixes a memory leak.

* Add XPORT_AHCI to the cam_xport enum for AHCI attachments.

14 years agoRemove remaining host.conf(5) traces.
Sascha Wildner [Mon, 1 Jun 2009 22:00:33 +0000 (00:00 +0200)]
Remove remaining host.conf(5) traces.

14 years agougensa(4): Fix handling of Huawei modems.
Sascha Wildner [Sun, 31 May 2009 10:07:36 +0000 (12:07 +0200)]
ugensa(4): Fix handling of Huawei modems.

Basically move the calling of the reattach code to get the Huawei
modem out of mass storage mode into the _match() routine and
simplify the logic behind when calling it and when not.

Now it is called for any Huawei modem if it has only one interface,
probably only a mass storage interface. Normally this mass-storage
interface is used under windows as it carries the windows-drivers
for the device. As we don't need it, we just tell the box that we
want the modem interface and not mass storage.

Dragonfly-bug: <http://bugs.dragonflybsd.org/issue1324>
Submitted-by: Alex Hornung <ahornung@gmail.com>
Tested-by: Brendan Kosowski <bmk@bmk.com.au>
Approved-by: hasso
14 years agoRemove symbols not in libpthread (libc_r).
Hasso Tepper [Sat, 30 May 2009 17:56:26 +0000 (20:56 +0300)]
Remove symbols not in libpthread (libc_r).

Pthread stubs must not have symbols which are not in the libpthread.
Unbreaks a hell of lot things in the pkgsrc.

14 years agoath(4): Really unbreak MODULES_WITH_WORLD building.
Sascha Wildner [Sat, 30 May 2009 15:01:20 +0000 (17:01 +0200)]
ath(4): Really unbreak MODULES_WITH_WORLD building.

14 years agoACPI P-State support step 1/2: Extract information from ACPI objects
Sepherosa Ziehau [Sat, 30 May 2009 11:31:00 +0000 (19:31 +0800)]
ACPI P-State support step 1/2: Extract information from ACPI objects

14 years agoacpi_cpu: Let cpu driver install ACPI-CA notify handler; C-State driver
Sepherosa Ziehau [Fri, 29 May 2009 09:35:59 +0000 (17:35 +0800)]
acpi_cpu: Let cpu driver install ACPI-CA notify handler; C-State driver
registers its handler to cpu driver (its parent)

14 years agoacpi_cpu: Override resource alloc/release methods.
Sepherosa Ziehau [Fri, 29 May 2009 08:32:31 +0000 (16:32 +0800)]
acpi_cpu: Override resource alloc/release methods.

Tested-by: hasso@
14 years agoacpi_cpu: Split C-State support out of cpu driver.
Sepherosa Ziehau [Fri, 29 May 2009 05:10:58 +0000 (13:10 +0800)]
acpi_cpu: Split C-State support out of cpu driver.

New cpu driver only contains minimum code to detect processor object,
and create necessary cpu sysctl nodes; this paves the way for the
P-State support.

Noticable changes to the userland:
- hw.cpuX sysctl trees are move to hw.acpi.cpuX
- C-State support could be disabled individually by "cpu_cst"
- The device tree is now acpi0.cpuX.cpu_cstX, instead of acpi0.cpuX

14 years agoifpoll: Let callers of {st,io}poll_clock() hold critical section.
Sepherosa Ziehau [Thu, 28 May 2009 09:19:33 +0000 (17:19 +0800)]
ifpoll: Let callers of {st,io}poll_clock() hold critical section.

14 years agoifpoll: Adjust status polling's cached pollhz iff we are on CPU0
Sepherosa Ziehau [Thu, 28 May 2009 08:51:40 +0000 (16:51 +0800)]
ifpoll: Adjust status polling's cached pollhz iff we are on CPU0

14 years agodrm: add support for Intel G41
Simon Schubert [Thu, 28 May 2009 07:59:50 +0000 (09:59 +0200)]
drm: add support for Intel G41

Submitted-by: hasso@
14 years agodrm: adapt and use drm_close
Simon Schubert [Thu, 28 May 2009 07:52:42 +0000 (09:52 +0200)]
drm: adapt and use drm_close

While importing the last drm code, drm_close was not properly ported and
integrated.  Thus, opens only incremented the reference count, but code
for closes and decrementing the reference count never was executed.

As a result, Xorg drivers, which during probing drm open and close the
device several times, would not be able to perform certain operations
due to a wrong reference count.

14 years agoifpoll: Add sysctl nodes for TX and status polling fraction.
Sepherosa Ziehau [Thu, 28 May 2009 06:36:53 +0000 (14:36 +0800)]
ifpoll: Add sysctl nodes for TX and status polling fraction.

14 years agoifpoll: Move status sysctl tree to net.ifpoll.0
Sepherosa Ziehau [Thu, 28 May 2009 05:57:04 +0000 (13:57 +0800)]
ifpoll: Move status sysctl tree to net.ifpoll.0

14 years agoifpoll: Rework systimer related bits after lapic timer could be used.
Sepherosa Ziehau [Thu, 28 May 2009 05:38:37 +0000 (13:38 +0800)]
ifpoll: Rework systimer related bits after lapic timer could be used.

Percpu systimers were commented out before lapic timer code was ready,
mainly to avoid high frequency timers staggering cross CPUs, which
may double the timer frequency and timer ipi rate.  After the lapic
timer is ready, we no longer need to worry cross CPUs timer frequency
staggering and timer ipi boardcasting, so percpu systimer could be
safely enabled at almost no cost.

However, care must be taken to avoid CPU-local lapic timer frequency
staggering, since TX, RX and status polling could use different
frequency; the current implementation let RX systimer give TX and status
polling a piggyback to avoid this kind of timer frequency staggering.

14 years agolibc: consolidate pthread stub functions
Simon Schubert [Tue, 26 May 2009 20:15:47 +0000 (22:15 +0200)]
libc: consolidate pthread stub functions

To Hasso's and my surprise we are maintaining two sets of stub functions
for pthread.  These stubs are present so that consumers that are thread
aware, but don't require pthreads, will successfully link even without
-lpthread.

pthread_fake.c was introduced for external consumers, I believe Xorg.
It provided externally visible weak symbols for pthread_* functions that
all returned an error.

_pthread_stubs.c was introduced later so that libc could be made pthread
aware.  It provided only stub functions that are used by libc itself,
provided by weak symbols for _pthread_* (notice leading underscore).
These functions returned always success, so that libc could operate
properly.

This consolidation now provides weak symbols for both pthread_* and
_pthread_* for all functions defined by libpthread, except for
pthread_create.  These functions return success and/or behave properly.

14 years agoundo: don't double free path
Simon Schubert [Tue, 26 May 2009 20:12:30 +0000 (22:12 +0200)]
undo: don't double free path

14 years agogcc34: fix spello in comment
Simon Schubert [Mon, 25 May 2009 12:30:56 +0000 (14:30 +0200)]
gcc34: fix spello in comment

14 years agoSync zoneinfo database with tzdata2009h from elsie.
Sascha Wildner [Tue, 26 May 2009 23:07:04 +0000 (01:07 +0200)]
Sync zoneinfo database with tzdata2009h from elsie.

README:         8.2  -> 8.3
Theory:         8.2  -> 8.3
africa:         8.19 -> 8.21
antarctica:     8.4  -> 8.5
asia:           8.30 -> 8.32
australasia:    8.9  -> 8.11
backward:       8.7  -> 8.8
etcetera:       8.1  -> 8.2
europe:         8.20 -> 8.21
factory:        8.1  -> 8.2
iso3166.tab:    8.5  -> 8.6
leapseconds:    8.7  -> 8.8
northamerica:   8.27 -> 8.28
southamerica:   8.34 -> 8.36
systemv:        8.1  -> 8.2
zone.tab:       8.26 -> 8.28

From Arthur David Olson's comments:

* "Public domain" statements are added to a number of files.

* Instances of "=3D" are changed to "=" in the "africa"
  and "southamerica" files.

* The start of DST in Jordan from 2002 forward is changed from
  0:00 on the last Friday of the month to 24:00 on the last Thursday.

* Four sets of latitute/longitude are corrected in the "zone.tab" file
  (with thanks to Marc Wick).

* Commentary is added to the "australasia" file regarding DST in
  South Australia (no changes to the rules).

14 years agolibthread_xu: disable use of version script
Simon Schubert [Wed, 27 May 2009 09:32:24 +0000 (11:32 +0200)]
libthread_xu: disable use of version script

Due to a bug(?) in the gcc driver, the version script has not been used
previously.  Since we pass it directly to the linker, threaded
applications have been crashing erratically.  Correctly disable the
version script until this issue is resolved.

Tracked-down-by: hasso@
14 years agostdint.h: rearrange declarations into separate files
Simon Schubert [Wed, 27 May 2009 09:32:06 +0000 (11:32 +0200)]
stdint.h: rearrange declarations into separate files

The current machine/stdint.h situation is a mess.  It declares only the
__versions of stdint integers, but also defines limit and constant
macros.  Furthermore it also declares non-integer types.

Break out integer limit and constant macros into their own machine/
headers and include all of these headers from <stdint.h>, but not from
machine/stdint.h.  The declaration of integer_t types still happens in
main stdint.h.

This is slightly based on NetBSD's way of doing it.

14 years agonlookup.9: Remove references to namei() which we don't have.
Stathis Kamperis [Tue, 26 May 2009 21:14:21 +0000 (00:14 +0300)]
nlookup.9: Remove references to namei() which we don't have.

Reported-by: Jordan Gordeev <jgordeev@dir.bg>
Reviewed-by: Sascha Wildner <swildner@dragonflybsd.org>
14 years agosystat(1): vmmeter -> pvmmeter
Sepherosa Ziehau [Mon, 25 May 2009 11:04:48 +0000 (19:04 +0800)]
systat(1): vmmeter -> pvmmeter

Complained-by: many
14 years agotap(4): More fixes to tapuponopen.
Sepherosa Ziehau [Mon, 18 May 2009 14:17:42 +0000 (22:17 +0800)]
tap(4): More fixes to tapuponopen.

If tap(4) is cloned, we bring down the interface during closing only
if the interface was brought up during opening.

14 years agotap(4): Correct reversed logic
Sepherosa Ziehau [Mon, 18 May 2009 13:13:19 +0000 (21:13 +0800)]
tap(4): Correct reversed logic

14 years agotap(4): Add ifclone support
Sepherosa Ziehau [Mon, 18 May 2009 13:17:08 +0000 (21:17 +0800)]
tap(4): Add ifclone support

Submitted-by: Naoya Sugioka <naoya.sugioka@gmail.com> w/ following changes:
- Moniro style changes
- Comment out destroy upon closing, mainly to keep old tap(4) behaviour
- Poll interface should return 0 instead of nevent
- Use SLITS_FOREACH_MUTABLE() when destroying tap interfaces
- Pass tap_softc to tapdestroy()
- tap_entries -> tap_link
- Cloners handle their own attach/detach events
- Correct tapuponopen support

14 years agoAdd syscall.9 adapted from OpenBSD.
Stathis Kamperis [Sun, 17 May 2009 13:28:05 +0000 (16:28 +0300)]
Add syscall.9 adapted from OpenBSD.

Reviewed-by: swildner@
14 years agovkernel - more crit section work to avoid pthread reentrancy.
Matthew Dillon [Sun, 24 May 2009 03:02:50 +0000 (20:02 -0700)]
vkernel - more crit section work to avoid pthread reentrancy.