dragonfly.git
5 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.

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

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

5 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

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

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

5 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

5 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

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

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

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

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

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

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

5 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

5 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

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

5 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>
5 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

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

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

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

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

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

5 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

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

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

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

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

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

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

5 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

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

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

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

5 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

5 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

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

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

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

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

5 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

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

5 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@
5 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

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

5 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

5 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@
5 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.

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

5 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

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

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

5 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

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

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

5 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@
5 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.

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

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

5 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

5 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@
5 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.

5 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Matthew Dillon [Sat, 23 May 2009 23:25:25 +0000 (16:25 -0700)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

5 years agoMiscellanious protection around pthread calls to avoid signal reentrancy.
Matthew Dillon [Sat, 23 May 2009 23:21:53 +0000 (16:21 -0700)]
Miscellanious protection around pthread calls to avoid signal reentrancy.

Use pread/pwrite instead of read/write in a few cases.  Cases that still
use read/write now protect the calls with a crit_enter()/crit_exit().

Protect usleep() calls with a critical section.

Protect pthread_*() calls with a critical section where applicable.  Note
that calls made from cothreads do not need to be protected because the
cothreads do not take signals and are not operated as virtual cpus so they
can't preempt themselves either.

Reported-by: Trevor Kendall
5 years agoamd64 - Fix compiler warning.
Matthew Dillon [Sat, 23 May 2009 23:20:08 +0000 (16:20 -0700)]
amd64 - Fix compiler warning.

5 years agohammer.8: Fix typo.
Sascha Wildner [Sat, 23 May 2009 12:02:24 +0000 (14:02 +0200)]
hammer.8: Fix typo.

5 years agolibthread_xu: Use -Wl,... for passing linker options.
Sascha Wildner [Sat, 23 May 2009 11:47:09 +0000 (13:47 +0200)]
libthread_xu: Use -Wl,... for passing linker options.

Fixes building with clang which doesn't support --version-script.

Submitted-by: Alex Hornung <ahornung@gmail.com>
5 years agotcp timer: Don't try stopping timers if timer message is not created.
Sepherosa Ziehau [Sat, 23 May 2009 11:01:15 +0000 (19:01 +0800)]
tcp timer: Don't try stopping timers if timer message is not created.

DragonFly-bug: <http://bugs.dragonflybsd.org/issue1380>

5 years agolibkvm: Raise WARNS to 2 and fix warnings.
Sascha Wildner [Sat, 23 May 2009 11:05:57 +0000 (13:05 +0200)]
libkvm: Raise WARNS to 2 and fix warnings.

Includes adding a prototype for dev2udev() to kern_kinfo.c if compiled
for userland.

5 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Matthew Dillon [Sat, 23 May 2009 04:33:00 +0000 (21:33 -0700)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

5 years agoSupporting amd64 /dev/kmem requires allowing apparently negative lseek offsets.
Matthew Dillon [Sat, 23 May 2009 04:32:03 +0000 (21:32 -0700)]
Supporting amd64 /dev/kmem requires allowing apparently negative lseek offsets.

5 years agolibkvm - use the proper format %lx for kva, which is an unsigned long.
Matthew Dillon [Sat, 23 May 2009 04:29:07 +0000 (21:29 -0700)]
libkvm - use the proper format %lx for kva, which is an unsigned long.

5 years agoobjformat(1): Fix comment typo and trailing newline.
Sascha Wildner [Sat, 23 May 2009 01:59:58 +0000 (03:59 +0200)]
objformat(1): Fix comment typo and trailing newline.

5 years agoAdjust objformat.1 and getobjformat.3 to the current state of affairs.
Sascha Wildner [Sat, 23 May 2009 01:59:12 +0000 (03:59 +0200)]
Adjust objformat.1 and getobjformat.3 to the current state of affairs.

5 years agoDocument hw.irq.X.dest in loader(8) manpage
Sepherosa Ziehau [Fri, 22 May 2009 11:16:06 +0000 (19:16 +0800)]
Document hw.irq.X.dest in loader(8) manpage

Reminded-by: dillon@
5 years agolibc_r: map initial stack red zone with MAP_TRYFIXED
Simon Schubert [Thu, 21 May 2009 20:43:56 +0000 (22:43 +0200)]
libc_r: map initial stack red zone with MAP_TRYFIXED

This is analogous to 9b505694017eeaf48fff9273f503160064583c14 and
2035b67992ac162a5968a22584ef29d2f53f93e2.

With-help-from: smtms, dillon

5 years agoRemove .sh suffix from the last 3 rc scripts that had it.
Sascha Wildner [Thu, 21 May 2009 17:24:42 +0000 (19:24 +0200)]
Remove .sh suffix from the last 3 rc scripts that had it.

5 years agoioapic: Allow user to specify irq's destination CPU
Sepherosa Ziehau [Thu, 21 May 2009 13:38:45 +0000 (21:38 +0800)]
ioapic: Allow user to specify irq's destination CPU

hw.irq.X.dest is checked when programming ioapic and the corresponding
ithread will be created on the same CPU as the irq's destination CPU.

5 years agoioapic: Fix destination setting.
Sepherosa Ziehau [Thu, 21 May 2009 10:59:24 +0000 (18:59 +0800)]
ioapic: Fix destination setting.

Since the "destination mode" is physical, the "destination" should be
APIC ID instead of mask (set of processors).  Currently all interrupts
are delivered to CPU0 (BSP).

5 years agovknet.8: Fix typo.
Sascha Wildner [Thu, 21 May 2009 09:17:01 +0000 (11:17 +0200)]
vknet.8: Fix typo.

5 years agovknetd.8: Document Matt's recent changes to vknetd(8).
Sascha Wildner [Thu, 21 May 2009 09:10:43 +0000 (11:10 +0200)]
vknetd.8: Document Matt's recent changes to vknetd(8).

5 years agovknetd.8: Start sentences on new lines.
Sascha Wildner [Thu, 21 May 2009 09:04:32 +0000 (11:04 +0200)]
vknetd.8: Start sentences on new lines.

5 years agoath_hal.4: Update a bit for the recent HAL update (taken from FreeBSD).
Sascha Wildner [Thu, 21 May 2009 08:51:59 +0000 (10:51 +0200)]
ath_hal.4: Update a bit for the recent HAL update (taken from FreeBSD).

5 years agoetc/rc.d/sendmail: Actually execute sendmail_precmd().
Sascha Wildner [Wed, 20 May 2009 20:03:35 +0000 (22:03 +0200)]
etc/rc.d/sendmail: Actually execute sendmail_precmd().

This will cause the sendmail rc script to care about running
newaliases(1) itself if necessary (database doesn't exist or
/etc/mail/aliases is newer than /etc/mail/aliases.db).

Also add a new rc.conf variable 'sendmail_rebuild_aliases' to
turn off this behavior which is on by default.

This means we don't need to run newaliases(1) ourselves in a
couple of places (such as when building the LiveCD), so remove
those.

Dragonfly-bug: <http://bugs.dragonflybsd.org/issue52>

5 years agoundo: free temporary filename
Simon Schubert [Wed, 20 May 2009 15:39:59 +0000 (17:39 +0200)]
undo: free temporary filename

5 years agoundo: always collect history of the file
Simon Schubert [Wed, 20 May 2009 15:39:37 +0000 (17:39 +0200)]
undo: always collect history of the file

Commit b9a33d3fb1235626615b96b4b586ce7a7b8386fd added file histories based
on the history of the parent directory, in order to list history fragments
even when the inode changed.  However it failed to collect the history for
the most recent version of the file.  As a result, if all versions of the
parent directory happened to preceed the oldest version of the file, undo
would not collect any history for the file and fail with error 0.

Unconditionally include the history of the file to fix this problem.

5 years agoaac(4): Functions called on the interrupt processing code path is not MPSAFE
Sepherosa Ziehau [Wed, 20 May 2009 13:18:17 +0000 (21:18 +0800)]
aac(4): Functions called on the interrupt processing code path is not MPSAFE
yet, so don't mark its interrupt handler MPSAFE.

Reported-and-tested-by: Archimedes Gaviola <archimedes.gaviola@gmail.com>
5 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Matthew Dillon [Wed, 20 May 2009 02:48:38 +0000 (19:48 -0700)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

5 years agoSave creds on nfs_open() for later read/write/etc.
Matthew Dillon [Wed, 20 May 2009 02:44:00 +0000 (19:44 -0700)]
Save creds on nfs_open() for later read/write/etc.

Recent commits removed an unnecessary access() call in the open path.
However, this broke NFS's saving of creds for future use.  Replicate
the cred code in nfs_open().

Reported-by: Thomas Nikolajsen <thomas.nikolajsen@mail.dk>
5 years agonewvers.sh: Take the src/ dir as an argument instead of hard coding it.
Sascha Wildner [Tue, 19 May 2009 14:04:12 +0000 (16:04 +0200)]
newvers.sh: Take the src/ dir as an argument instead of hard coding it.

This fixes the issue where the last number in our version was included
only if /usr/src was present at build time, which resulted in different
output of uname -r, sysctl kern.{osrelease,version}, etc. across
different systems (e.g. "2.3.1-DEVELOPMENT" vs. "2.3-DEVELOPMENT").

This commit also removes the passing of ${KERN_IDENT} and ${IDENT} to
newvers.sh (both of which are not used by it) and performs some
additional cleanup.

Brought-to-my-attention-by: Antonio Huete Jimenez <ahuete.devel@gmail.com>
Reviewed-by: dillon
5 years agoath(4) HAL: Set AH_SUPPORT_AR5416 to 1 for now (unbreaks buildkernel).
Sascha Wildner [Tue, 19 May 2009 13:52:19 +0000 (15:52 +0200)]
ath(4) HAL: Set AH_SUPPORT_AR5416 to 1 for now (unbreaks buildkernel).

5 years ago- Staticize cpu_initclocks()
Sepherosa Ziehau [Tue, 19 May 2009 13:11:46 +0000 (21:11 +0800)]
- Staticize cpu_initclocks()
- Correct vktimer_intr_initclock() prototype

5 years agoamd64: Sync isa/clock.c with i386's
Sepherosa Ziehau [Tue, 19 May 2009 13:01:06 +0000 (21:01 +0800)]
amd64: Sync isa/clock.c with i386's