summaryrefslogtreecommitdiff
path: root/sys/dev/ic/nvme.c
AgeCommit message (Collapse)Author
2022-11-25nvme can do 64bit dma.David Gwynne
ok jmatthew@
2022-07-10Remove trailing whitespace. No code change.Mike Larkin
2022-04-16constify SCSI adapter entry pointsChristian Weisgerber
ok krw@
2021-08-31sprinkle barriers and dmamem_syncs around the hibernate io path.David Gwynne
at the very least it stops the compiler omgoptimising away important code. tested by and ok deraadt@ jmatthew@
2021-08-29Reduce the number of openings for aplns(4) to 1. This isn't correct butMark Kettenis
make NVMe on the Apple M1 stable. Hopefully we can figure out the real issue in the future. ok jmatthew@
2021-07-08fix the hibernate io path.David Gwynne
a botched merge meant i was posting the previously used slot to the chip to process before posting the current slot. ok deraadt@
2021-06-02Correctly calculate number of PRPL entries we have to sync by addingPatrick Wildt
brackets to manage operator precedence. Otherwise we'd attempt to sync more than needed, which doesn't cause issues, but it's still wrong. ok dlg@ jmatthew@
2021-05-31make nvme_read8 and write8 less clever.David Gwynne
hopefully big endian still works.
2021-05-31try to get rid of a weird comma on the alpns attach line.David Gwynne
"makes sense" jmatthew@
2021-05-29Only allocate the "hibernate" queue when HIBERNATE support is being built.Mark Kettenis
This makes the NVMe storage on the Apple M1 machines actually work! ok patrick@, dlg@
2021-05-28provide nvme_ops for vanilla pci nvme, and use them in the right places.David Gwynne
this paves the way for supporting the apple nvme storage controllers. hopefully most of the remaining work on that is in the bus glue for those controllers and this code won't need more tweaks. hibernate still works, but it's relying on luck at the moment. hibernate on arm64 and the apple controllers in particular will almost certainly require more work here. ok jmatthew@
2021-05-28move the nvme_dmamem prototypes so bus glue can use them.David Gwynne
ok jmatthew@
2021-05-28move nvme_barrier to nvmevar.h, just to keep it with the other reg ops.David Gwynne
2021-05-28let nvme_read8 and nvme_write8 get used by bus glue too.David Gwynne
ok jmatthew@
2021-05-28move the nvme_read4 and nvme_write4 macros to the header.David Gwynne
this allows nvme bus glue to use the macros too. ok jmatthew@
2021-02-25Prevent zero size devices from attachingjan
This also fixes two NULL ptr derefs in later code path. OK patick@, krw@
2021-02-09Add a barrier between reading the cqe flags and the command ID, whichJonathan Matthew
should ensure that we don't read a stale command ID and complete the wrong scsi io. powerpc64 base builds were crashing like this fairly regularly. ok deraadt@ dlg@
2020-10-15Replace simple one-line bcopy()/memcpy() of faked data into scsi_xfer with callKenneth R Westerback
to scsi_copy_internal_data(). Thus getting xs->resid properly set and adding the usual uio/size sanity checks.
2020-09-22Since dlg@'s 2009 scsi midlayer refactoring the 'struct scsi_generic *cmd'Kenneth R Westerback
member of 'struct scsi_xfer' has always been pointed at the 'struct scsi_generic cmdstore' member of the same instance. So nuke 'cmdstore' and remove the '*' from cmd. Take the address of cmd as required by the various casts. No intentional functional change. luna88k test by aoyama@, sparc64 test by jmatthew@ Identification of 2009's last *cmd use and ok jmatthew@
2020-09-05Replace '32' with SID_SCSI2_ALEN (a.k.a. 31) when building emulated INQUIRYKenneth R Westerback
responses. This is what the SCSI specifications say is the correct value and already used in several cases.
2020-09-03Replace '.response_format = 2' with '.response_format = SID_SCSI2_RESPONSE'.Kenneth R Westerback
2020-09-02When building emulated INQUIRY results use the SCSI_REV_* #define's toKenneth R Westerback
initialize the 'version' field. Not numbers.
2020-09-01Rename [READ|WRITE]_BIG to [READ|WRITE]_10. Rename struct scsi_rw_big toKenneth R Westerback
struct scsi_rw_10. ok gnezdo@ jmatthew@ (who also did sparc64 compile test)
2020-07-20Move remaining scsi bus initialization info from "prototype scsi link"Kenneth R Westerback
fields to struct scsibus_attach_args. Nuke the struct scsi_link * (saa_sc_link) in scaibus_attach_args. Explicitly initialize each field in scsibus_attach_args variables.
2020-07-19Move the adapter related items (luns, adapter, adapter_target,Kenneth R Westerback
adapter_buswidth, adapter_softc) from struct scsi_link to struct scsibus_attach_args. Additional compile tests by jmatthew@ (sparc64) and aoyam@ (luna88k).
2020-07-16Access adapter softc via link->bus->sb_adapter_softc.Kenneth R Westerback
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.
2020-07-12False alarm, back it goes. Managed to mangle my kernel build directoryKenneth R Westerback
somehow. Cleaning it out and config/compile from scratch and all seems well.
2020-07-11Revert previous. Broke something somehow.Kenneth R Westerback
2020-07-11Garbage collect unused nvme_softc member "sc_scsibus".Kenneth R Westerback
2020-06-29Don't create sd(4) devices for nvme(4) namespaces that areKenneth R Westerback
configured but have a size of 0. Should eliminate the 31 bogus sd(4) devices reported by Janne Johansson (occasionally known as jj@) on some Micron SSD's that passed through his hands. Doesn't break my nvme SSD's, nor jca@'s. ok deraadt@
2020-06-27No need to bzero()/memset() 'struct scsibus_attach_args' variablesKenneth R Westerback
immediately before initializing the only field in the struct.
2020-03-15sparc64 issue being identified and removed, reapply r1.73:Kenneth R Westerback
"Bump nvme(4) max physio() i/o size to 128K"
2020-03-15Revert nvme back to last working commit for sparc64.kmos
The coverity-related diff breaks sparc64's ability to read the disk. ok deraadt
2020-03-13Bump nvme(4) max physio() i/o size to 128K.Kenneth R Westerback
2020-03-10Coverity points out (12 + MAXMPS) can never be less thanKenneth R Westerback
12. PAGE_SHIFT is 12 (a.k.a. PAGE_SIZE == 4096) or more on OpenBSD architectures. So remove some dead code by unconditionally setting sc_mps (memory page size) to 1 << PAGE_SHIFT. CID 1491655. No functional change.
2020-03-10sgl (scatter gather list) and prpl (physical region page list) are twoKenneth R Westerback
different things in the NVMe world. Only the latter is currently implemented in nvme(4) so rename sc_max_sgl to sc_max_prpl to reflect this. No functional change.
2020-03-02Shuffle logic a bit to make sizes/limits more obvious.Kenneth R Westerback
No functional change.
2020-03-01Use ffs() on sc_mps, removing need for sc_mps_bits. Replace ffs(64)-1Kenneth R Westerback
and ffs(16)-1 with the constant results (i.e. 6 and 4). Add comments to clarify use of these constants. Net result, one less invocation of ffs(), softc smaller by one u_int, and less potential confusion over 'mps'. No functional change.
2020-02-28nvme_enable() doesn't need parameters for both sc and sc->sc_mps_bits.Kenneth R Westerback
Nuke the latter and use the former to get the same value.
2020-02-27Trailing whitespace.Kenneth R Westerback
2020-02-15Don't touch the phase bit at nvme_poll_done(). This makes dumpsys()YASUOKA Masahiko
work with nvme. ok jmatthew
2020-02-05Nuke unnecessary abstraction 'scsi_minphys()' which just callsKenneth R Westerback
'minphys()'. Just use & check for NULL instead, since 'minphys()' is always called on the code path ([cd|sd|st]minphys) that calls physio().
2020-01-23Use a consistant idiom/format when declaring scsi_adapter structuresKenneth R Westerback
in drivers. Terse one liners, NULLs instead of 0's, explicitly specify all members, etc. Nuke #ifdef notyet blocks related to the scsi_adapter in aic. No intentional functional change. ok tedu@
2019-07-27Make target numbers match the NVMe namespace identifiers. This fixes bootingMark Kettenis
from nvme(4) on sparc64 as the OBP device paths contain namespace identifiers that we end up matching to targets when trying to find the device we booted from. Also results in (slightly) cleaner code and less confusion as the numbers now match instead of being off-by-one. ok dlg@
2019-05-08when freeing ccbs, pass the number so we can free with the size.Ted Unangst
ok deraadt mpi
2018-01-10Attach nvme to additional Apple NVMe device, limit targets to 1Joshua Stein
ok dlg
2017-08-18Avoid a NULL dereference in an error path. Coverity CID 1453201.Jonathan Gray
ok mikeb@
2017-06-12typo; from bryan vyhmeisterTheo de Raadt
2017-05-29Add hibernate support for nvme(4). This creates a separate IO queue that isJonathan Matthew
only active during hibernation, preallocating the the submission and completion queues during attach as they need to be page-aligned. tested on an x270 that successfully hibernates now. ok dlg@
2017-05-27nvme: Don't set prp1 for DEL_IOCQStefan Fritsch
NVM_ADMIN_DEL_IOCQ does not need prp1 (just as NVM_ADMIN_DEL_IOSQ). Remove what is likely a cut'n'paste error from the *_ADD_* code. tested by claudio@ ok jmatthew@