History log of /openbsd/sys/dev/ic/ahci.c (Results 1 – 25 of 41)
Revision Date Author Comments
# 6579b5f8 28-May-2024 jsg <jsg@openbsd.org>

Move ccb access before ccb_done to avoid a potential use-after-free
if pages can be freed from interrupt context. ok dlg@


# 6b06da21 23-Apr-2024 jsg <jsg@openbsd.org>

use 1U << 31 to avoid undefined behaviour
ok miod@


# af293b3d 03-Feb-2023 miod <miod@openbsd.org>

Remove redundant DIAGNOSTIC wrappers around KASSERT macros.
From Crystal Kolipe.


# 51d3b00d 09-Apr-2022 naddy <naddy@openbsd.org>

atascsi: constify method tables

ok miod@


# 0b29cb40 16-Jul-2020 krw <krw@openbsd.org>

Access adapter softc via link->bus->sb_adapter_softc.

In sparc64 autoconf access 'luns' via sb_luns and 'adapter_buswidth'
via sb_adapter_buswidth.

Removes last post-config uses of the copies of bu

Access adapter softc via link->bus->sb_adapter_softc.

In sparc64 autoconf access 'luns' via sb_luns and 'adapter_buswidth'
via sb_adapter_buswidth.

Removes last post-config uses of the copies of bus related
information in scsi_link.

show more ...


# 189d7e68 14-Mar-2020 krw <krw@openbsd.org>

ahci_get_pmp_ccb() returns a non-NULL pointer, fails a
KASSERT(), or has already blown up by dereferencing the
pointer.

Two of the four invocations of ahci_get_pmp_ccb() check for
NULL. Save a coupl

ahci_get_pmp_ccb() returns a non-NULL pointer, fails a
KASSERT(), or has already blown up by dereferencing the
pointer.

Two of the four invocations of ahci_get_pmp_ccb() check for
NULL. Save a couple of bytes by not bothering. Add comments
to the invocations to docuement the assumption.

show more ...


# 77db1dd4 14-Mar-2020 krw <krw@openbsd.org>

Trailing whitespace, long lines, incorrect function names in
printf()'s.


# 014fa59d 08-Jul-2019 mlarkin <mlarkin@openbsd.org>

Remove some "set but not used" variables in ahci(4)'s hibernate code.

ok jmatthew


# e1989b51 25-Jun-2019 patrick <patrick@openbsd.org>

Turn off the code which waits for AHCI_PREG_CMD_CR to be set by the
HBA after ahci_default_port_start() sets AHCI_PREG_CMD_ST. The AHCI
spec. rev. 1.3 only requires the inverse to be true, i. e. that

Turn off the code which waits for AHCI_PREG_CMD_CR to be set by the
HBA after ahci_default_port_start() sets AHCI_PREG_CMD_ST. The AHCI
spec. rev. 1.3 only requires the inverse to be true, i. e. that a
HBA clears AHCI_PREG_CMD_CR when AHCI_PREG_CMD_ST gets cleared by
software/driver. In fact, some HBAs will not raise AHCI_PREG_CMD_CR
as an immediate consequence of AHCI_PREG_CMD_ST being set. Actually
neither the FreeBSD, Linux nor NetBSD counterpart of ahci(4) has an
analogous check. Disabling that wait fixes "failed to start command
DMA on port N, disabling" bails during attach.

From Marius Strobl
ok deraadt@ jmatthew@

show more ...


# 96739e86 21-Aug-2017 jmatthew <jmatthew@openbsd.org>

Split up ahci_port_portreset into a few smaller bits, and also slightly
adjust port multiplier detection so it doesn't call ahci_port_portreset
again directly, but instead restarts the loop for the c

Split up ahci_port_portreset into a few smaller bits, and also slightly
adjust port multiplier detection so it doesn't call ahci_port_portreset
again directly, but instead restarts the loop for the current call.

During attach, poll for device detection across all ports until either all
ports have detected a device, or one second has passed, rather than doing
them sequentially. Devices are still attached in order of port number,
so disk unit numbers won't change.

ok visa@

show more ...


# 0b4b247e 13-Aug-2017 mlarkin <mlarkin@openbsd.org>

improve AHCI hibernate writeout performance by doing smaller delay()s
between each I/O.

ok kettenis@, jmatthew@


# 6f1d62e9 30-May-2017 jmatthew <jmatthew@openbsd.org>

Remove comments about implementing FIS-based switching with port multipliers,
which we can safely assume isn't going to happen now. No code changes.


# 92a87063 05-Mar-2017 jmatthew <jmatthew@openbsd.org>

When we're unable to determine which NCQ command failed, fail all active
commands rather than proceeding to an assertion failure. This matches
how we handle the same condition with non-queued comman

When we're unable to determine which NCQ command failed, fail all active
commands rather than proceeding to an assertion failure. This matches
how we handle the same condition with non-queued commands, and the
behaviour of every other ahci driver I can find. Add a printf there so
we might get some idea of how often this condition arises and what happens
afterwards.

ok dlg@

show more ...


# 7dbd8a00 02-Oct-2016 patrick <patrick@openbsd.org>

Some HABs reset parts of AHCI_PREG_CMD when AHCI_PREG_SCTL_DET_INIT
gets set. Therefore, ahci_port_softreset() restores the sate of the
former register once the device detection sequence is finished.

Some HABs reset parts of AHCI_PREG_CMD when AHCI_PREG_SCTL_DET_INIT
gets set. Therefore, ahci_port_softreset() restores the sate of the
former register once the device detection sequence is finished. The
device detection code in ahci_pmp_port_portreset() does not restore
AHCI_PREG_CMD afterwards, so let it catch up. Apparently, this part
was an oversight as ahci_pmp_port_portreset() did not otherwise use
"cmd".

From Marius Strobl

tested by awolk (amd64), bluhm (amd64, i386), myself (amd64, armv7)
ok jmatthew@

show more ...


# fd58cd83 02-Oct-2016 patrick <patrick@openbsd.org>

Some HBAs report NCQ capability despite only supporting one command
slot. Thus, extend the check whether NCQ actually should be enabled
accordingly.

From Marius Strobl

tested by awolk (amd64), bluh

Some HBAs report NCQ capability despite only supporting one command
slot. Thus, extend the check whether NCQ actually should be enabled
accordingly.

From Marius Strobl

tested by awolk (amd64), bluhm (amd64, i386), myself (amd64, armv7)
ok jmatthew@

show more ...


# 9ae3568a 02-Oct-2016 patrick <patrick@openbsd.org>

Given that ahci_port_alloc() grabs one CCB for use during NCQ error
recovery from the CCB pool sized based on the NCS capability, i. e.
number of command slots reported by the controller, it is neces

Given that ahci_port_alloc() grabs one CCB for use during NCQ error
recovery from the CCB pool sized based on the NCS capability, i. e.
number of command slots reported by the controller, it is necessary
to pretend at least 2 slots in sc->sc_ncmds for devices without NCQ
support. That way, also at least 1 available slot is made available
for atascsi(4). Otherwise, controllers having only a single command
slot will trigger "no free xfers on a new port" in atascsi(4).
Note that pretending 2 command slots is also fine with the abuse of
the NCQ error recovery CCB in ahci_port_softreset().

From Marius Strobl

tested by awolk (amd64), bluhm (amd64, i386), myself (amd64, armv7)
ok jmatthew@

show more ...


# b70c9e02 02-Oct-2016 patrick <patrick@openbsd.org>

Contrary to e. g. the xHCI specification, the AHCI rev. 1.3 spec
does not say anything about which type (snoopable/uncached etc.) of
bus transactions are issued by HBAs on accesses to the descriptors

Contrary to e. g. the xHCI specification, the AHCI rev. 1.3 spec
does not say anything about which type (snoopable/uncached etc.) of
bus transactions are issued by HBAs on accesses to the descriptors.
Thus, the right assumption would be "classical" concurrent accesses
by both CPU/driver as well as hardware to the descriptors and their
DMA memory backings respectively, which is also confirmed by actual
testing. Consequently, switch to BUS_DMA_COHERENT mappings for said
DMA memory as otherwise corruption of descriptors is seen.

From Marius Strobl

tested by awolk (amd64), bluhm (amd64, i386), myself (amd64, armv7)
ok jmatthew@

show more ...


# 20f90945 10-Mar-2016 krw <krw@openbsd.org>

Enforce some naming sanity. Stop using 'sc_link' to mean two different
things by renaming the field 'SLIST_HEAD(, scsi_link) sc_link' to
'sc_link_list' in struct scsibus_softc. Use 'sb' as the short

Enforce some naming sanity. Stop using 'sc_link' to mean two different
things by renaming the field 'SLIST_HEAD(, scsi_link) sc_link' to
'sc_link_list' in struct scsibus_softc. Use 'sb' as the short name
for scsibus_softc variables.

Impetus from & ok bluhm@

show more ...


# 4ba7bf3b 04-Oct-2015 jmatthew <jmatthew@openbsd.org>

Fix memory leak in error path.
From Benjamin Baier, found by llvm/scan-build.


# 1f559dca 27-Aug-2015 deraadt <deraadt@openbsd.org>

sizes for free()


# 9cd47e4c 21-Mar-2015 mpi <mpi@openbsd.org>

Print speeds consistently.

ok brynet@, miod@


# 17fb629f 12-Mar-2015 brynet <brynet@openbsd.org>

Print the current link speed for SATA devices attached on ahci(4).

The port numbers correspond to scsibus(4) targets:

ahci0: port 0, at 6Gbps
ahci0: port 2, at 3Gbps
scsibus1 at ahci0: 32 targets
s

Print the current link speed for SATA devices attached on ahci(4).

The port numbers correspond to scsibus(4) targets:

ahci0: port 0, at 6Gbps
ahci0: port 2, at 3Gbps
scsibus1 at ahci0: 32 targets
sd0 at scsibus1 targ 0 ..
sd1 at scsibus1 targ 2 ..

ok deraadt@, tested by bmercer@

show more ...


# 1ec8db95 11-Feb-2015 jmatthew <jmatthew@openbsd.org>

include extended capabilities in ahci debug output
ok dlg@


# a4da9f86 11-Feb-2015 jmatthew <jmatthew@openbsd.org>

recognise ahci 1.3.1
ok dlg@


# 93c0f120 03-Dec-2014 jsg <jsg@openbsd.org>

Turn ahci port start into a callback so sxiahci can do some magic to
setup dma. Modified version of a patch from Edwin Amsler which was
based on changes made in Bitrig by Artturi Alm.

ok dlg@


12