summaryrefslogtreecommitdiffstats
path: root/sys/dev/ic/nvme.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Add a barrier between reading the cqe flags and the command ID, whichjmatthew2021-02-091-1/+3
| | | | | | | | 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@
* Replace simple one-line bcopy()/memcpy() of faked data into scsi_xfer with callkrw2020-10-151-2/+2
| | | | | to scsi_copy_internal_data(). Thus getting xs->resid properly set and adding the usual uio/size sanity checks.
* Since dlg@'s 2009 scsi midlayer refactoring the 'struct scsi_generic *cmd'krw2020-09-221-4/+4
| | | | | | | | | | | | 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@
* Replace '32' with SID_SCSI2_ALEN (a.k.a. 31) when building emulated INQUIRYkrw2020-09-051-2/+2
| | | | | responses. This is what the SCSI specifications say is the correct value and already used in several cases.
* Replace '.response_format = 2' with '.response_format = SID_SCSI2_RESPONSE'.krw2020-09-031-2/+2
|
* When building emulated INQUIRY results use the SCSI_REV_* #define's tokrw2020-09-021-2/+2
| | | | initialize the 'version' field. Not numbers.
* Rename [READ|WRITE]_BIG to [READ|WRITE]_10. Rename struct scsi_rw_big tokrw2020-09-011-3/+3
| | | | | | struct scsi_rw_10. ok gnezdo@ jmatthew@ (who also did sparc64 compile test)
* Move remaining scsi bus initialization info from "prototype scsi link"krw2020-07-201-5/+5
| | | | | | | 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.
* Move the adapter related items (luns, adapter, adapter_target,krw2020-07-191-6/+6
| | | | | | | adapter_buswidth, adapter_softc) from struct scsi_link to struct scsibus_attach_args. Additional compile tests by jmatthew@ (sparc64) and aoyam@ (luna88k).
* Access adapter softc via link->bus->sb_adapter_softc.krw2020-07-161-9/+9
| | | | | | | | 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.
* False alarm, back it goes. Managed to mangle my kernel build directorykrw2020-07-121-3/+2
| | | | | somehow. Cleaning it out and config/compile from scratch and all seems well.
* Revert previous. Broke something somehow.krw2020-07-111-2/+3
|
* Garbage collect unused nvme_softc member "sc_scsibus".krw2020-07-111-3/+2
|
* Don't create sd(4) devices for nvme(4) namespaces that arekrw2020-06-291-12/+7
| | | | | | | | | | | | 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@
* No need to bzero()/memset() 'struct scsibus_attach_args' variableskrw2020-06-271-2/+1
| | | | immediately before initializing the only field in the struct.
* sparc64 issue being identified and removed, reapply r1.73:krw2020-03-151-4/+14
| | | | "Bump nvme(4) max physio() i/o size to 128K"
* Revert nvme back to last working commit for sparc64.kmos2020-03-151-15/+8
| | | | | | The coverity-related diff breaks sparc64's ability to read the disk. ok deraadt
* Bump nvme(4) max physio() i/o size to 128K.krw2020-03-131-4/+14
|
* Coverity points out (12 + MAXMPS) can never be less thankrw2020-03-101-5/+2
| | | | | | | | | | 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.
* sgl (scatter gather list) and prpl (physical region page list) are twokrw2020-03-101-8/+8
| | | | | | | | 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.
* Shuffle logic a bit to make sizes/limits more obvious.krw2020-03-021-14/+12
| | | | No functional change.
* Use ffs() on sc_mps, removing need for sc_mps_bits. Replace ffs(64)-1krw2020-03-011-4/+4
| | | | | | | | | 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.
* nvme_enable() doesn't need parameters for both sc and sc->sc_mps_bits.krw2020-02-281-6/+6
| | | | Nuke the latter and use the former to get the same value.
* Trailing whitespace.krw2020-02-271-7/+7
|
* Don't touch the phase bit at nvme_poll_done(). This makes dumpsys()yasuoka2020-02-151-2/+2
| | | | | | work with nvme. ok jmatthew
* Nuke unnecessary abstraction 'scsi_minphys()' which just callskrw2020-02-051-2/+2
| | | | | | 'minphys()'. Just use & check for NULL instead, since 'minphys()' is always called on the code path ([cd|sd|st]minphys) that calls physio().
* Use a consistant idiom/format when declaring scsi_adapter structureskrw2020-01-231-6/+2
| | | | | | | | | | | 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@
* Make target numbers match the NVMe namespace identifiers. This fixes bootingkettenis2019-07-271-10/+10
| | | | | | | | | 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@
* when freeing ccbs, pass the number so we can free with the size.tedu2019-05-081-7/+10
| | | | ok deraadt mpi
* Attach nvme to additional Apple NVMe device, limit targets to 1jcs2018-01-101-1/+13
| | | | ok dlg
* Avoid a NULL dereference in an error path. Coverity CID 1453201.jsg2017-08-181-4/+2
| | | | ok mikeb@
* typo; from bryan vyhmeisterderaadt2017-06-121-2/+2
|
* Add hibernate support for nvme(4). This creates a separate IO queue that isjmatthew2017-05-291-3/+219
| | | | | | | | 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@
* nvme: Don't set prp1 for DEL_IOCQsf2017-05-271-2/+1
| | | | | | | | 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@
* nvme: Add suspend/resume codesf2017-05-271-5/+75
| | | | | | | Based on an initial patch by ehrhardt@ . Thanks to claudio@ for testing and deraadt@ for advice. "go ahead" deraadt@
* subtract one sector from the disk size before passing it back to thejcs2017-05-121-3/+5
| | | | | | | | | | scsi layer, which will add one sector back fixes incorrect disk size reporting which was causing fdisk to create a protective MBR of one too many sectors, which caused our EFI bootloader to fail to recognize it as a GPT disk ok dlg
* A pile of sizes to free(9). In test for a few days in snapshots.deraadt2017-04-081-5/+5
| | | | | Errors will result in nice clean panic messages so we know what's wrong. Reviewed by dhill visa natano jsg.
* Do not use bus_space_{read,write}_8() even on LP64 archs,mpi2016-11-151-8/+5
| | | | | | | | some (broken) controllers require ordered split transfers. From linux a310acd7a7ea53533886c11bb7edd11ffd61a036 Tested by gonzalo@, ok dlg@
* Mask non relevant bits when pritting version number.mpi2016-11-151-28/+3
| | | | | | Makes gonzalo@'s Macbookair7,1 NVMe report the correct version. ok dlg@
* mask and unmask the interrupt source in an intx specific intr handler.dlg2016-10-251-1/+14
| | | | | | | | | | | | | | | it seems devices using levelled intx interrupts need to explicitely ack interrupts by masking and unmasking the source around the completion ring handling. without this completions can be lost, which in turn causes long (permanent?) stalls in the block layer under heavy write load. ive experienced this problem with an intel nvme part that only has intx and msix support. because we dont support msix yet we only use intx on it. it appeared to lock up before this fix. this has been tested on both that intel board and a samsung with msi. this fix was based on work found in code by nonaka
* check we allocated the cq, not the sq, after trying to allocate the cqdlg2016-05-201-2/+2
| | | | found by NONAKA Kimihiro while he was porting nvme to netbsd.
* allocate an array of entries, not pointers for the queuesdlg2016-04-181-3/+3
| | | | | | | | | | | | | | | | | this solves my memory corruption problem with a samsung sm951 in a particular slot on a dell 2950. hilariously, i had picked values which masked this problem on sparc64. i randomly picked 128 as the number of entries on the queues, and dmamem allocs get rounded up to PAGE_SIZE. on amd64 and sparc64 this meant i was asking for 128 * 8 (sizeof pointer), or 1024 bytes, which got rounded up to 4096 and 8192 on each arch respectively. 128 * 64 (the size of a submission queue entry) is 8192, so it worked fine on sparc64 for that reason, but randomly blows up on amd64. the 2950 above allocated mbufs out of the page after the submission queue, which i ended over overwriting. anyway. let's move on.
* shorten the io path slightlydlg2016-04-141-32/+14
|
* apparently it's spelled NVMe, not NVMEdlg2016-04-141-2/+2
|
* provide a shutdown hook that follows the procedure in the docsdlg2016-04-141-1/+95
|
* implement translation of scsi SYNC CACHE to nvme FLUSHdlg2016-04-141-1/+55
|
* bump openings to 64 to match the number of ccbs.dlg2016-04-141-2/+2
| | | | still a bit magical, but good enough for now.
* if io needs more than two prpe slots, overflow into the ccb prpldlg2016-04-141-2/+25
| | | | this should be enough to make io reliable
* reallocate the ccbs after we figure out how big the sgls can bedlg2016-04-141-1/+10
| | | | | we run with 2 entries for the nvme controller identify, and then bump it up to cover the maxphys divided by the page size we negotiate.
* set the scsi status to SCSI_OKdlg2016-04-141-1/+2
|