dragonfly.git
14 years agoFix amd64 compile issue: I386_BUS_SPACE_IO -> AMD64_BUS_SPACE_IO.
Matthew Dillon [Wed, 17 Jun 2009 22:45:56 +0000 (15:45 -0700)]
Fix amd64 compile issue: I386_BUS_SPACE_IO -> AMD64_BUS_SPACE_IO.

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

14 years agoFix typo
Michael Neumann [Wed, 17 Jun 2009 21:52:49 +0000 (23:52 +0200)]
Fix typo

14 years agoCCD - Allow ccd to be kldunload'd.
Matthew Dillon [Wed, 17 Jun 2009 21:50:03 +0000 (14:50 -0700)]
CCD - Allow ccd to be kldunload'd.

14 years agodisk subsystem - Fixup dev->si_* fields for XXXs0, e.g. da0s0
Matthew Dillon [Wed, 17 Jun 2009 21:01:47 +0000 (14:01 -0700)]
disk subsystem - Fixup dev->si_* fields for XXXs0, e.g. da0s0

The si_* fields for rawdev are not set until after the disk_create()
call, so someone using the cooked version of the raw device (i.e. da0s0)
will not get the right si_iosize_max unless we fix it up here.

14 years agopriv: Narrow down privileges
Michael Neumann [Wed, 17 Jun 2009 20:59:18 +0000 (22:59 +0200)]
priv: Narrow down privileges

14 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Michael Neumann [Wed, 17 Jun 2009 20:27:55 +0000 (22:27 +0200)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

14 years agopriv: Narrow down privileges; new PRIV_JAIL_CREATE
Michael Neumann [Wed, 17 Jun 2009 20:25:43 +0000 (22:25 +0200)]
priv: Narrow down privileges; new PRIV_JAIL_CREATE

14 years agopriv: Narrow down privileges
Michael Neumann [Wed, 17 Jun 2009 20:23:11 +0000 (22:23 +0200)]
priv: Narrow down privileges

14 years agoSILI - Work around hardware LRAM bugs part 2/2.
Matthew Dillon [Wed, 17 Jun 2009 19:33:56 +0000 (12:33 -0700)]
SILI - Work around hardware LRAM bugs part 2/2.

* Add ATA_F_AUTOSENSE and ATA_F_EXCLUSIVE to deal with accessing the
  D2H RFIS.

  ATA_F_AUTOSENSE tells sili.c that the caller wants to access the rfis.
  The sili core is then responsible for copying the rfis out of the LRAM
  and into host-memory.

  ATA_F_EXCLUSIVE tells sili.c that the caller wants to be the only
  command queued to the chip for that particular command.

* Currently ATA_F_AUTOSENSE implies ATA_F_EXCLUSIVE, but ultimately we will
  want to do the auto-sense as a separate step so things like ATAPI farms
  can run commands in parallel.

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

14 years agoPCIDEVS - Add vendors
Matthew Dillon [Wed, 17 Jun 2009 19:31:13 +0000 (12:31 -0700)]
PCIDEVS - Add vendors

* Add PCI_VENDOR_SII (0x1095)
* Add PCI_PRODUCT_SII_3132 (0x3132)

14 years agoDEVS - Clean up some reference counting issues
Matthew Dillon [Wed, 17 Jun 2009 19:29:13 +0000 (12:29 -0700)]
DEVS - Clean up some reference counting issues

* Add dev_ops_remove_override() as the counterpart to dev_ops_add_override().

* Do not complain if ops->head.refs is non-zero when deleting ops,
  as the ops structure might be used with other unit numbers.

* Fix a bad assertion that was leading to incorrect panics when selectively
  removing dev_ops.

14 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Michael Neumann [Wed, 17 Jun 2009 19:22:59 +0000 (21:22 +0200)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

14 years agopriv: Introduce PRIV_VM_RESIDENT and use it
Michael Neumann [Wed, 17 Jun 2009 19:21:36 +0000 (21:21 +0200)]
priv: Introduce PRIV_VM_RESIDENT and use it

14 years agopriv: Narrow down privileges
Michael Neumann [Wed, 17 Jun 2009 19:18:45 +0000 (21:18 +0200)]
priv: Narrow down privileges

14 years agoSILI - Work around hardware LRAM bugs part 1/2.
Matthew Dillon [Wed, 17 Jun 2009 17:27:00 +0000 (10:27 -0700)]
SILI - Work around hardware LRAM bugs part 1/2.

After tearing my hair out a bit and wondering why the Sili chip couldn't
have more then one command pending on a port at a time when talking to a PM,
I found an issue reported in the Linux sili device driver related to its
LRAM.  Basically, reading from the Sili chip's LRAM while commands are active
will corrupt it.

The solution is to use a completely external PRB rather then the PRB in
the LRAM, and use the command activation register to start the command
instead of the command FIFO (which only works for the fixed PRBs in the LRAM).

This commit fixes basic command dispatch but does not yet handle situations
where the RFIS must be read from the LRAM... for example, when reading data
from a PM SCA register or reading sense data from an ATAPI command.  With
this commit I can dd from 5 drives behind a PM in parallel.

14 years agoFix kernel compile error in last commit due to lack of types.h in some sources
Matthew Dillon [Wed, 17 Jun 2009 16:50:12 +0000 (09:50 -0700)]
Fix kernel compile error in last commit due to lack of types.h in some sources

14 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Matthew Dillon [Wed, 17 Jun 2009 15:32:14 +0000 (08:32 -0700)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

14 years agoBUSDMA - Add bus_space_kva()
Matthew Dillon [Wed, 17 Jun 2009 15:31:12 +0000 (08:31 -0700)]
BUSDMA - Add bus_space_kva()

* Add bus_space_kva(), a function which returns a real pointer to access
  things like mapped shared memory (used by SILI).

-Matt

14 years agosh(1): Reset getopt(3) before executing built-in commands.
Stathis Kamperis [Wed, 17 Jun 2009 13:21:16 +0000 (16:21 +0300)]
sh(1): Reset getopt(3) before executing built-in commands.

Before patch:
$ printf "test\n"
test
$ jobs -l
$ printf "test\n"
usage: printf format [arg ...]
$

After patch:
$ printf "test\n"
test
$ jobs -l
$ printf "test\n"
test
$

The bug isn't tight to jobs(1) or printf(1). Every use of getopt(3) would
advance `optind' and make the next built-in command think that it wasn't
supplied with enough arguments. NetBSD is doing as we do. FreeBSD doesn't
have printf(1) as built-in so it is not affected. The patch has survived
a build{world, kernel}.

14 years agoAHCI - Remove DIAGNOSTICs
Matthew Dillon [Wed, 17 Jun 2009 08:26:10 +0000 (01:26 -0700)]
AHCI - Remove DIAGNOSTICs

They don't compile anyway.

Reported-by: Sascha Wildner <saw@online.de>
14 years agoAHCI - Bring fixes in from SILI.
Matthew Dillon [Wed, 17 Jun 2009 06:54:54 +0000 (23:54 -0700)]
AHCI - Bring fixes in from SILI.

* Use ahci_os_softsleep() more

* Clean out active and pending CCBs when a port is disconnected, fixing
  hangs of programs that were accessing the disks at the time.

* Clear ap_expired bitmap when completing a CCB.

* Fix max_target specification so CAM bus scans only run through 15.

* Lock port around ATAPI command

14 years agoSILI - Silicon Image 3132 driver, initial commit
Matthew Dillon [Wed, 17 Jun 2009 06:43:24 +0000 (23:43 -0700)]
SILI - Silicon Image 3132 driver, initial commit

This driver was derived from the AHCI driver and retooled extensively
for the Silicon Image chipset.  It retains all the cool features from the
AHCI driver including port multiplier (PM) support, NCQ, and hot-plug for
both direct-attached and PM-attached targets.

This initial commit is very alpha and the driver has significant PM-related
bugs.  It is not yet ready for prime time.

14 years agoCAM - Change XPORT_AHCI to XPORT_SATA.
Matthew Dillon [Wed, 17 Jun 2009 05:00:13 +0000 (22:00 -0700)]
CAM - Change XPORT_AHCI to XPORT_SATA.

Noticed-by: corecode
14 years agoAHCI - separate pmreg.h out, always zero the FIS in ahci_ata_get_xfer()
Matthew Dillon [Tue, 16 Jun 2009 19:02:16 +0000 (12:02 -0700)]
AHCI - separate pmreg.h out, always zero the FIS in ahci_ata_get_xfer()

* Separate the register defs for PMs out into pmreg.h, as they are not
  AHCI-specific.

* Always zero the FIS returned by ahic_ata_get_xfer().  Don't let any cruft
  accumulate.

14 years agoAHCI - augment ahci_pm_check_good() to handle targets larger then pmcount.
Matthew Dillon [Tue, 16 Jun 2009 01:38:33 +0000 (18:38 -0700)]
AHCI - augment ahci_pm_check_good() to handle targets larger then pmcount.

14 years agoAHCI - go back to reading the EINFO register, check for unexpected EINFO bits
Matthew Dillon [Tue, 16 Jun 2009 01:36:16 +0000 (18:36 -0700)]
AHCI - go back to reading the EINFO register, check for unexpected EINFO bits

* Go back to reading the EINFO register.  We still have some issues with
  the PM not generating an interrupt for target port change events, this
  may clear it up.

* Report unexpected EINFO bits set beyond the number of supported targets.

14 years agoAHCI - add new kenv "hint.ahci.nofeatures"
Matthew Dillon [Mon, 15 Jun 2009 23:04:23 +0000 (16:04 -0700)]
AHCI - add new kenv "hint.ahci.nofeatures"

set hint.ahci.nofeatures in /boot/loader.conf or at the boot loader command
line to tell the AHCI driver not to attempt to set the security freeze on
a device.  Some devices will stop operating.

14 years agoAHCI - Add additional information in the CMD TIMEOUT message.
Matthew Dillon [Mon, 15 Jun 2009 22:04:16 +0000 (15:04 -0700)]
AHCI - Add additional information in the CMD TIMEOUT message.

* Also dump the STS state when printing the CMD TIMEOUT messeage.

14 years agoSet tty ownership on pty open (temporary until devfs is integrated)
Matthew Dillon [Mon, 15 Jun 2009 21:50:06 +0000 (14:50 -0700)]
Set tty ownership on pty open (temporary until devfs is integrated)

Fix a very long standing issue when opening new pty's as non-root.  The
related tty could not be chowned/chmoded in that case, giving any user
in the system access to the pty.

This would not effect programs like sshd which set up the pty as root, but
it did effect programs like xterm which do not run suid-root.

This is strictly a temporary fix until devfs can be integrated into the
system.  Basically we allow the uid stored in the cdev_t structure to
override the uid returned by VOP_GETATTR for VCHR devices, and the chmod
helper function checks the uid stored in the cdev_t structure for
compatibility.

Reported-by: Hasso Tepper <hasso@estpak.ee>, Numerous others
14 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Matthew Dillon [Mon, 15 Jun 2009 16:31:15 +0000 (09:31 -0700)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

14 years agoAHCI - Add hint.ahci.force150. Force negotiation at 1.5GBits.
Matthew Dillon [Mon, 15 Jun 2009 16:13:42 +0000 (09:13 -0700)]
AHCI - Add hint.ahci.force150.  Force negotiation at 1.5GBits.

* Add a feature which forces the AHCI controller to negotiate at 1.5 GBits
  instead of 3 GBits.

14 years agoahci.4: Fix typo.
Sascha Wildner [Mon, 15 Jun 2009 00:11:34 +0000 (02:11 +0200)]
ahci.4: Fix typo.

14 years agoAdd an ahci(4) manual page from OpenBSD (with some adaptation).
Sascha Wildner [Sun, 14 Jun 2009 23:51:01 +0000 (01:51 +0200)]
Add an ahci(4) manual page from OpenBSD (with some adaptation).

14 years agoAdjust the LiveDVD's beastie.4th too for the AHCI option.
Sascha Wildner [Sun, 14 Jun 2009 22:45:34 +0000 (00:45 +0200)]
Adjust the LiveDVD's beastie.4th too for the AHCI option.

14 years agoGENERIC kernel build - build-in the AHCI driver.
Matthew Dillon [Sun, 14 Jun 2009 22:33:47 +0000 (15:33 -0700)]
GENERIC kernel build - build-in the AHCI driver.

* The ahci driver is now part of the GENERIC kernel build.

14 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Matthew Dillon [Sun, 14 Jun 2009 22:32:21 +0000 (15:32 -0700)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

14 years agoAHCI - Add kenv "boot.hint.ahci_disabled", and add a boot menu option for it
Matthew Dillon [Sun, 14 Jun 2009 22:30:53 +0000 (15:30 -0700)]
AHCI - Add kenv "boot.hint.ahci_disabled", and add a boot menu option for it

* Setting the variable "boot.hint.ahci_disabled" in the boot loader will
  disable the AHCI driver's probe, causing AHCI devices to fall back to
  the NATA driver.

* The boot menu now has an option to boot with the AHCI driver disabled.

14 years agosbin/hammer/cmd_mirror.c: Stick with style(9) bracing style.
Sascha Wildner [Sun, 14 Jun 2009 18:18:14 +0000 (20:18 +0200)]
sbin/hammer/cmd_mirror.c: Stick with style(9) bracing style.

14 years agoAHCI - Minor console output spew cleanup
Matthew Dillon [Sun, 14 Jun 2009 17:40:38 +0000 (10:40 -0700)]
AHCI - Minor console output spew cleanup

14 years agoSimplify logical expression
Michael Neumann [Sun, 14 Jun 2009 16:52:03 +0000 (18:52 +0200)]
Simplify logical expression

14 years agoImplement -y "force yes" option for hammer utility.
Michael Neumann [Sun, 14 Jun 2009 16:43:16 +0000 (18:43 +0200)]
Implement -y "force yes" option for hammer utility.

This fixes a problem with terminals when operating remotely via ssh while
using the auto-PFS creation feature of hammer mirror-stream or
hammer mirror-copy.

For more information see the following thread (off-box mirror-stream and
friends):

http://leaf.dragonflybsd.org/mailarchive/users/2009-02/msg00017.html

14 years agotest
Michael Neumann [Sun, 14 Jun 2009 16:18:09 +0000 (18:18 +0200)]
test

14 years agoMADT MP probe: Rework cpuid mapping, and cpuid to apicid mapping
Sepherosa Ziehau [Sun, 14 Jun 2009 11:39:44 +0000 (19:39 +0800)]
MADT MP probe: Rework cpuid mapping, and cpuid to apicid mapping

- Don't use the ACPI ProcessorID as our cpuid, some BIOSes count ProcessorID
  from 1, and ACPI standards actually allow that.  Instead, except for BSP,
  we set the processor's cpuid in the order that we found the MADT LAPIC
  entry.
- Since MADT does not provide a way to identify the BSP, we will have to do
  it ourselves:

  Split the madt_parse() into three parts:
  o  madt_check(), preliminary length and revision check.
  o  madt_pass1(), locate the LAPIC address.
  o  madt_pass2(), set mp_naps and map cpuid to apicid.

  After madt_pass1(), the lapic is mapped, so we could get the current CPU's
  apic id.  Since the current CPU is BSP, we have the BSP's apic id.
  In madt_pass2(), we match the MADT LAPIC entry's apic_id field against the
  the value read from the current CPU's lapic id field.  Any matching means
  that entry contains information concerning BSP.

Reported-by: tuxillo on EFnet #dragonflybsd
14 years agoAHCI - Bug fixes - primary port probe and TFD flushing.
Matthew Dillon [Sun, 14 Jun 2009 06:07:00 +0000 (23:07 -0700)]
AHCI - Bug fixes - primary port probe and TFD flushing.

* The primary port probe was skipping the software reset step.

* ahci_flush_tfd() was looping on the SERR.DIAG.X bit with a 10ms delay,
  but on some parts this bit gets re-set very quickly if the port is
  in a COMRESET state.  Remove the loop, just use an if() instead.

Reported-by: Sepherosa Ziehau
14 years agoAHCI - Implement better timeout semantics, fix bug in error handling, softreset
Matthew Dillon [Sun, 14 Jun 2009 03:27:59 +0000 (20:27 -0700)]
AHCI - Implement better timeout semantics, fix bug in error handling, softreset

* Stopping a port with ahci_port_stop() is problematic if the port has not
  already been stopped by the command processor (CR is inactive), because
  command completions can race our saved CI register, leading to
  double-issues.  This creates issues with both NCQ and FBSS support.

  Change the timeout code to idle the port by allowing commands to
  complete normally until the only commands remaining are expired.
  Then the port can be safely stopped.

  The timeout code also no longer performs a softreset.  It used to under
  certain conditions.

* With the changes to the timeout code softreset is no longer being called
  from the timeout code, remove hacks from the softreset code that attempted
  to restore the command processing state on failure.

* The CAM code was not properly generating dummy SENSE data for command
  timeouts, leading the kernel to believe that the command succeeded
  when it in fact failed.

14 years agoAHCI - Port Multiplier bug fixes
Matthew Dillon [Sat, 13 Jun 2009 21:07:57 +0000 (14:07 -0700)]
AHCI - Port Multiplier bug fixes

* The error ccb must be used in ahci_pm_softreset() to collect a reliable
  signature from the device.

* Release the error ccb before performing any ahci_pm_*() functions (which
  have to issue their own commands).

* Probe the CAM bus asynchronously.

* Proactively assert that the error ccb is not used in a reentrant fashion.

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

14 years agoAHCI - fix minor bug in last commit.
Matthew Dillon [Sat, 13 Jun 2009 18:09:50 +0000 (11:09 -0700)]
AHCI - fix minor bug in last commit.

* Fix a broken KKASSERT()

14 years agoAHCI - Fix PM probing issues, wait 10 seconds on physical port insertion
Matthew Dillon [Sat, 13 Jun 2009 17:40:46 +0000 (10:40 -0700)]
AHCI - Fix PM probing issues, wait 10 seconds on physical port insertion

* The spec is not completely clear on the point but CCB[1] *MUST* be used
  as the second CCB in a softreset sequence.  If it isn't, the wrong
  signature may be loaded into the signature register.

* Wait 10 seconds on insertion of a physical port (we already wait 10 seconds
  on the insertion of a target behind a PM).

* Do not cycle the PHY when doing a hard reset, it seems to create
  detection problems.

14 years agoFallback to ACPI MADT CPU enumeration, if BIOS does not provide MP table.
Sepherosa Ziehau [Sat, 13 Jun 2009 12:17:43 +0000 (20:17 +0800)]
Fallback to ACPI MADT CPU enumeration, if BIOS does not provide MP table.

APIC_IO does not work with ACPI MADT CPU enumeration yet.

14 years agoAdd mp_set_cpuids(), which links CPU's logical id to its apic id
Sepherosa Ziehau [Sat, 13 Jun 2009 11:45:43 +0000 (19:45 +0800)]
Add mp_set_cpuids(), which links CPU's logical id to its apic id

14 years agosed(1): Remove the old regression tests.
Sascha Wildner [Sat, 13 Jun 2009 12:05:11 +0000 (14:05 +0200)]
sed(1): Remove the old regression tests.

FreeBSD's tests in tools/regression/usr.bin/sed are more comprehensive.

14 years agosed(1): Sync with FreeBSD.
Sascha Wildner [Sat, 13 Jun 2009 11:39:15 +0000 (13:39 +0200)]
sed(1): Sync with FreeBSD.

* Add workaround for a back reference when no corresponding parenthesized
  subexpression is defined. For example, the following command line caused
  unexpected behavior like segmentation fault:

  % echo test | sed -e 's/test/\1/'

* Fix the code to conform to the "or more" part of the following POSIX
  specification.

  "A function can be preceded by one or more '!' characters, in which
  case the function shall be applied if the addresses do not select
  the pattern space."

* Implement "addr1,+N" ranges - not dissimilar to grep's -A switch.

14 years agoFix several 'cound' typos.
Sascha Wildner [Sat, 13 Jun 2009 10:54:17 +0000 (12:54 +0200)]
Fix several 'cound' typos.

14 years agoImplement ACPI MADT parsing
Sepherosa Ziehau [Sat, 13 Jun 2009 10:41:54 +0000 (18:41 +0800)]
Implement ACPI MADT parsing

This will be used to enumerate CPUs if BIOS does not provide MP table

14 years agoAHCI - fixes to ahci_port_init()
Matthew Dillon [Sat, 13 Jun 2009 07:30:59 +0000 (00:30 -0700)]
AHCI - fixes to ahci_port_init()

* ahci_port_init() had some coding errors related to physical ports verses
  targets behind a port multiplier.  Correct the errors.

* Increase the post-boot insertion delay to 10 seconds.

14 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Matthew Dillon [Sat, 13 Jun 2009 07:08:36 +0000 (00:08 -0700)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

14 years agoAHCI - Port multiplier plug/unplug work, tuning, cleanup, bug fixes.
Matthew Dillon [Sat, 13 Jun 2009 07:02:39 +0000 (00:02 -0700)]
AHCI - Port multiplier plug/unplug work, tuning, cleanup, bug fixes.

* Clean up the command dispatch and polling code, including fixing a
  deadlock between the timeout code and the polling code.  The polling
  code now checks for timed-out CCBs.

* Test some of the delay intervals in the hard and softreset code to
  reduce protocol problems.

* Add an exclusive-access abstraction for dealing with device insertions
  and removals.  This isn't working perfectly yet, there are still some
  communications issues due to the newly inserted device interfering with
  devices already in the enclosure.

* Greatly reduce probe times.

14 years agoACPI P-State probing: Put _PCT evaluation error logging under bootverbose.
Sepherosa Ziehau [Sat, 13 Jun 2009 03:52:37 +0000 (11:52 +0800)]
ACPI P-State probing: Put _PCT evaluation error logging under bootverbose.

14 years agoMP table related static function renaming
Sepherosa Ziehau [Sat, 13 Jun 2009 03:42:38 +0000 (11:42 +0800)]
MP table related static function renaming

14 years agoGet rid of global variable 'boot_cpu_id'
Sepherosa Ziehau [Sat, 13 Jun 2009 03:16:53 +0000 (11:16 +0800)]
Get rid of global variable 'boot_cpu_id'

14 years agoCorrect mptable_pass[12]() function comment
Sepherosa Ziehau [Sat, 13 Jun 2009 02:56:21 +0000 (10:56 +0800)]
Correct mptable_pass[12]() function comment

14 years agoAHCI - Fix a bug in ahci_port_intr() when blockable == 0.
Matthew Dillon [Fri, 12 Jun 2009 23:19:35 +0000 (16:19 -0700)]
AHCI - Fix a bug in ahci_port_intr() when blockable == 0.

* The IS register was not being properly masked for the fall-through.

14 years agoAHCI - Implement parallel port scan and thread each port interrupt.
Matthew Dillon [Fri, 12 Jun 2009 21:45:35 +0000 (14:45 -0700)]
AHCI - Implement parallel port scan and thread each port interrupt.

* Implement a thread helper for each port.  The master interrupt will perform
  all actions which can be done without blocking and will delegate any
  remaining actions (typically error and timeout handling) to the
  port's thread helper.

* The thread helper is responsible for the initial probe.  Thus ALL AHCI
  SATA PORTS WILL NOW PROBE IN PARALLEL!  Instead of 6 ports each taking
  2 seconds to probe we now have 6 ports probing in a total of 2 seconds.

* Multiple port multipliers will probe in parallel, but targets on each
  one have to be iterated.

* The attach code waits for all ports to fully probe and then runs CAM
  attachments serially.  This step goes very quickly since the ports
  have already probed.

* Stalls on one physical port will no longer stall the rest of the ports.
  So, for example, stalls on the port connected to your port multiplier
  will not effect operations on, say, your internal SATA ports.

14 years agoCAM - Add missing protocol for xpt_action_async()
Matthew Dillon [Fri, 12 Jun 2009 16:31:43 +0000 (09:31 -0700)]
CAM - Add missing protocol for xpt_action_async()

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

14 years agoAHCI - follow fixes to CAM
Matthew Dillon [Fri, 12 Jun 2009 15:44:38 +0000 (08:44 -0700)]
AHCI - follow fixes to CAM

* Forgot to commit the CAM changes to use xpt_action_async().

14 years agoAdd missing ahci_pm.c to sys/conf/files.
Sascha Wildner [Fri, 12 Jun 2009 12:01:41 +0000 (14:01 +0200)]
Add missing ahci_pm.c to sys/conf/files.

This should fix the LINT build.

Reported-by: sephe
Dragonfly-bug: <http://bugs.dragonflybsd.org/issue1400>

14 years agomp_probe() -> mptable_probe()
Sepherosa Ziehau [Fri, 12 Jun 2009 10:31:40 +0000 (18:31 +0800)]
mp_probe() -> mptable_probe()

14 years agoChange mptable mapping mechanism during mptable parsing.
Sepherosa Ziehau [Fri, 12 Jun 2009 10:15:38 +0000 (18:15 +0800)]
Change mptable mapping mechanism during mptable parsing.

- Don't setup PTD for P=V, instead, pmap_mapdev() is used to mapping
  MP float pointer struct and MP base configuration table.
- Get rid of 'mpfps' global variable

14 years agomp_probe(): Return physical address of the MP float pointer struct
Sepherosa Ziehau [Fri, 12 Jun 2009 09:37:36 +0000 (17:37 +0800)]
mp_probe(): Return physical address of the MP float pointer struct

14 years agoReorder MP probing
Sepherosa Ziehau [Fri, 12 Jun 2009 08:56:20 +0000 (16:56 +0800)]
Reorder MP probing

- Defer mp_probe() from getmemsize() to mp_enable()
- Use pmap_mapdev when searching MP float pointer struct

14 years agoDefer mptable_pass1() from mp_probe() to mp_enable()
Sepherosa Ziehau [Fri, 12 Jun 2009 08:36:45 +0000 (16:36 +0800)]
Defer mptable_pass1() from mp_probe() to mp_enable()

14 years agoSave EBDA address before mp_probe()
Sepherosa Ziehau [Fri, 12 Jun 2009 08:06:13 +0000 (16:06 +0800)]
Save EBDA address before mp_probe()

14 years agomptable_pass1: Don't set ncpus to 1; it has already been setup.
Sepherosa Ziehau [Fri, 12 Jun 2009 04:33:05 +0000 (12:33 +0800)]
mptable_pass1: Don't set ncpus to 1; it has already been setup.

14 years agoAHCI - Fix CAM reentrancy problem, work-around HW async notification issue.
Matthew Dillon [Fri, 12 Jun 2009 08:45:28 +0000 (01:45 -0700)]
AHCI - Fix CAM reentrancy problem, work-around HW async notification issue.

* Our XPT_ENG_EXEC was not running asynchronously like we thought, nor
  was CAM_SCAN_BUS.  Use the not xpt_action_async() CAM call to ensure
  these run asynchrnously.

* The SDBS interrupt bit does not always get set when an async notification
  is receives.  It is unclear whether this is because the port multipler (PM)
  is sending a device set bits with 'N' but not 'I' flagged, or whether it
  is a bug in the host controller.  It only occurs while the AHCI port is
  under load.

14 years agoCAM - add xpt_action_async()
Matthew Dillon [Fri, 12 Jun 2009 08:07:11 +0000 (01:07 -0700)]
CAM - add xpt_action_async()

* The xpt_action_async() function works like xpt_action() but it guarantees
  the ccb will be run from an independant thread.

  This feature can be used by drivers to issue actions which they would like
  to occur in a different context.

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

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).