summaryrefslogtreecommitdiff
path: root/sys/dev/mpr
Commit message (Collapse)AuthorAgeFilesLines
* Make MAXPHYS tunable. Bump MAXPHYS to 1M.Konstantin Belousov2020-11-281-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace MAXPHYS by runtime variable maxphys. It is initialized from MAXPHYS by default, but can be also adjusted with the tunable kern.maxphys. Make b_pages[] array in struct buf flexible. Size b_pages[] for buffer cache buffers exactly to atop(maxbcachebuf) (currently it is sized to atop(MAXPHYS)), and b_pages[] for pbufs is sized to atop(maxphys) + 1. The +1 for pbufs allow several pbuf consumers, among them vmapbuf(), to use unaligned buffers still sized to maxphys, esp. when such buffers come from userspace (*). Overall, we save significant amount of otherwise wasted memory in b_pages[] for buffer cache buffers, while bumping MAXPHYS to desired high value. Eliminate all direct uses of the MAXPHYS constant in kernel and driver sources, except a place which initialize maxphys. Some random (and arguably weird) uses of MAXPHYS, e.g. in linuxolator, are converted straight. Some drivers, which use MAXPHYS to size embeded structures, get private MAXPHYS-like constant; their convertion is out of scope for this work. Changes to cam/, dev/ahci, dev/ata, dev/mpr, dev/mpt, dev/mvs, dev/siis, where either submitted by, or based on changes by mav. Suggested by: mav (*) Reviewed by: imp, mav, imp, mckusick, scottl (intermediate versions) Tested by: pho Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D27225 Notes: svn path=/head/; revision=368124
* Introduce support of SCSI Command Priority.Alexander Motin2020-10-251-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | SAM-3 specification introduced concept of Task Priority, that was renamed to Command Priority in SAM-4, and supported by all modern SCSI transports. It provides 15 levels of relative priorities: 1 - highest, 15 - lowest and 0 - default. SAT specification for SATA devices translates priorities 1-3 into NCQ high priority. This change adds new "priority" field into empty spots of struct ccb_scsiio and struct ccb_accept_tio of CAM and struct ctl_scsiio of CTL. Respective support is added into iscsi(4), isp(4), mpr(4), mps(4) and ocs_fc(4) drivers for both initiator and where applicable target roles. Minimal support was added to CTL to receive the priority value from different frontends, pass it between HA controllers and report in few places. This patch does not add consumers of this functionality, so nothing should really change yet, since the field is still set to 0 (default) on initiator and not actively used on target. Those are to be implemented separately. I've confirmed priority working on WD Red SATA disks connected via mpr(4) and properly transferred to CTL target via iscsi(4), isp(4) and ocs_fc(4). While there, added missing tag_action support to ocs_fc(4) initiator role. MFC after: 1 month Relnotes: yes Sponsored by: iXsystems, Inc. Notes: svn path=/head/; revision=367044
* Bring the request_descriptor union into harmony internally. NoScott Long2020-10-131-3/+3
| | | | | | | functional change. Notes: svn path=/head/; revision=366668
* Refine the busdma template interface. Provide tools for filling in fieldsScott Long2020-09-143-33/+29
| | | | | | | | | | that can be extended, but also ensure compile-time type checking. Refactor common code out of arch-specific implementations. Move the mpr and mps drivers to this new API. The template type remains visible to the consumer so that it can be allocated on the stack, but should be considered opaque. Notes: svn path=/head/; revision=365706
* mpr: clean up empty lines in .c and .h filesMateusz Guzik2020-09-0122-336/+23
| | | | Notes: svn path=/head/; revision=365204
* Remove extra memset() left after r342388.Alexander Motin2020-08-041-1/+0
| | | | | | | | | | | | | This memset() wiped MPI2_FUNCTION_SCSI_TASK_MGMT set by mprsas_alloc_tm(), that broke target reset on device removal, making later re-insertion into the same slot impossible, since firmware was still waiting for the driver to finish with the removed device. MFC after: 1 week Sponsored by: iXsystems, Inc. Notes: svn path=/head/; revision=363852
* mpr(4), mps(4): Stop checking for failures from malloc(M_WAITOK).Mark Johnston2020-07-273-31/+0
| | | | | | | | | | | PR: 240545 Submitted by: Andrew Reiter <arr@watson.org> Reviewed by: imp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D25766 Notes: svn path=/head/; revision=363608
* Add a small hack to the ioctl header files so that both mpr and mps canScott Long2020-04-161-0/+2
| | | | | | | | be included. This isn't a great solution, but fixing it correctly is a bigger task and this is the lesser of the existing evils. Notes: svn path=/head/; revision=360001
* Centralize compatability translation macros.Brooks Davis2020-04-141-10/+1
| | | | | | | | | | | | | | | | Copy the CP, PTRIN, etc macros from freebsd32.h into a sys/abi_compat.h and replace existing definitation with includes where required. This eliminates duplicate code and allows Linux and FreeBSD compatability headers to be included in the same files. Input from: cem, jhb Obtained from: CheriBSD MFC after: 2 weeks Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D24275 Notes: svn path=/head/; revision=359937
* Increase buffer in mprsas_log_command() from 192 to 224 bytes.Alexander Motin2020-03-131-1/+1
| | | | | | | | | | | 192 bytes are not enough to print long commands, such as ATA COMMAND PASS THROUGH(16), that makes debug output difficult to read. MFC after: 2 weeks Sponsored by: iXsystems, Inc. Notes: svn path=/head/; revision=358959
* Remove support for all pre FreeBSD 11.0 versions from mpr and mps.Warner Losh2020-02-264-453/+4
| | | | | | | | | | Remove a number of workarounds for older versions of FreeBSD. FreeBSD stable/10 was branched over 6 years ago. All of these changes date from about that time or earlier. These workarounds are extensive and get in the way of understanding the current flow in the driver. Notes: svn path=/head/; revision=358351
* Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many)Pawel Biernacki2020-02-261-4/+6
| | | | | | | | | | | | | | | | | | | r357614 added CTLFLAG_NEEDGIANT to make it easier to find nodes that are still not MPSAFE (or already are but aren’t properly marked). Use it in preparation for a general review of all nodes. This is non-functional change that adds annotations to SYSCTL_NODE and SYSCTL_PROC nodes using one of the soon-to-be-required flags. Mark all obvious cases as MPSAFE. All entries that haven't been marked as MPSAFE before are by default marked as NEEDGIANT Approved by: kib (mentor, blanket) Commented by: kib, gallatin, melifaro Differential Revision: https://reviews.freebsd.org/D23718 Notes: svn path=/head/; revision=358333
* Before issing the REMOVE_DEVICE command to the firmware, make sure that allWarner Losh2020-02-252-18/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | commands have completed. It's not OK to force complete any pending commands before we send the REMOVE_DEVICE. Instead, make sure that all pending commands are complete before sending that. By trying to second guess the firmware here, we run the risk of completing commands twice, which leads to corruption. This removes the forced completion of commands introduced in r218811. So it's a partial backout of that commit, but replaces it with a more rebust mechanism. Either these commands will complete due to the TARGET RESET, or they will timeout and be aborted, but they will all complete. Add assert that all commands are complete to REMOVE_DEVICE completion routine. We attempt to assure this programatically, so we shouldn't have any commands in the queue because we've waited for them all. Any commands that make it into our action routine after we mark the target in removal will complete immediately with an error. When we're removing a target that's not a volume, advertise up the stack that it's actually gone, as opposed to having a transient selection error we should retry. Do this both in the action routine, and when we get a notification of an aborted command. We don't do this for volumes because the driver tries hard not to advertise to the OS a volume has disappeared. Apply these changes to both mpr and mps since they are based on quite similar designs. Discussed with: scottl@ Differential Revision: https://reviews.freebsd.org/D23768 Notes: svn path=/head/; revision=358308
* Advertise the MPI Message Version that's contained in the IOCFacts messageScott Long2020-02-072-2/+13
| | | | | | | | | | | | in the sysctl block for the driver. mpsutil/mprutil needs this so it can know how big of a buffer to allocate when requesting the IOCFacts from the controller. This eliminates the kernel console messages about wrong allocation sizes. Reported by: imp Notes: svn path=/head/; revision=357651
* Convert the mpr driver to use busdma templates.Scott Long2019-12-243-101/+52
| | | | Notes: svn path=/head/; revision=356052
* Fix leak in state machine for commands.Warner Losh2019-11-241-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When we get a device departed message from the firmware, we send a TARGET_REST to the device to let the firmware know we're done and as part of the recovery process. This will abort all the commands. While the documentation says the IOC is responsible for writing the completion message for all the commands pending with an aborted status, we sometimes have queued commands for the target that haven't been completed so are in the INQUEUE state. So, when we later complete the pending CCB as aborted, these commands are freed and we hit the "state not busy" panic. Elsewhere where we dequeue commands, we move the state to BUSY from INQUEUE. Do that here as well. In talking to Ken, Scott and Justin, they recommended a series of tests to see if this is 100% safe. Those tests are ongoing, but preliminary tests suggest this is safe as we see no duplicate completions when we hit this case at work. We have a machine that has a dodgy powersupply which usually doesn't apply power to a few drives, but sometimes does when the machine is under heavy load so we get a rash of the connect / disconnect messages over half an hour. Without this change, we'd see state not busy panic. With this change, the drives just annoyingly come and go without affecting the rest of the machine, but without a complete error injection test suite, it's hard to know if all edge cases are now covered or not. Discussed with: scottl, ken, gibbs Notes: svn path=/head/; revision=355056
* More fully implement the state machine.Warner Losh2019-07-111-1/+2
| | | | | | | | | | | When a command is finished running, we must transition it from INQUEUE to busy state. We were failing to do that, so we hit a panic when the commands were freed. This only affects mpr, mps already did simmilar things. Now both the polling and interrupt paths properly set BUSY as appropriate. Notes: svn path=/head/; revision=349909
* Fix bugs in recovery path and improve cm trackingWarner Losh2019-07-084-15/+25
| | | | | | | | | | | | | | | | | | | | | Eliminate the TIMEDOUT state. This state really conveyed two different concepts: I timed out during recovery (and my command got put on the recovery queue), and I timed out diring discovery (which doesn't). Separate those two concepts into two flags. Use the TIMEDOUT flag to fail requests as timed out. Use the on queue flag to remove them from the queue. In mps_intr_locked for MPI2_RPY_DESCRIPT_FLAGS_ADDRESS_REPLY message type, when completing commands, ignore the ones that are not in state INQUEUE. They were already completed as part of the recovery process. When we complete them twice, we wind up with entries on the free queue that are marked as busy, trigging asserts. Reviewed by: scottl (earlier version, just for mpr) Differential Revision: https://reviews.freebsd.org/D20785 Notes: svn path=/head/; revision=349849
* Fix busy status leak in case of incorrect passthrough args.Alexander Motin2019-05-301-2/+4
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=348417
* Extract eventfilter declarations to sys/_eventfilter.hConrad Meyer2019-05-201-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | This allows replacing "sys/eventfilter.h" includes with "sys/_eventfilter.h" in other header files (e.g., sys/{bus,conf,cpu}.h) and reduces header pollution substantially. EVENTHANDLER_DECLARE and EVENTHANDLER_LIST_DECLAREs were moved out of .c files into appropriate headers (e.g., sys/proc.h, powernv/opal.h). As a side effect of reduced header pollution, many .c files and headers no longer contain needed definitions. The remainder of the patch addresses adding appropriate includes to fix those files. LOCK_DEBUG and LOCK_FILE_LINE_ARG are moved to sys/_lock.h, as required by sys/mutex.h since r326106 (but silently protected by header pollution prior to this change). No functional change (intended). Of course, any out of tree modules that relied on header pollution for sys/eventhandler.h, sys/lock.h, or sys/mutex.h inclusion need to be fixed. __FreeBSD_version has been bumped. Notes: svn path=/head/; revision=347984
* Add missing newline to debug printf.Warner Losh2019-05-081-1/+1
| | | | Notes: svn path=/head/; revision=347237
* Add missing break statements. Coverity CID 1400446.Scott Long2019-03-271-0/+2
| | | | | | | Reported by: mav Notes: svn path=/head/; revision=345573
* Add event table decoding for SAS Broadcast Primitive events.Scott Long2019-03-241-0/+10
| | | | Notes: svn path=/head/; revision=345485
* r329522 created problemss with commands that enter the TIMEDOUT state butScott Long2019-03-241-4/+2
| | | | | | | | | | | | | | are successfully returned by the card (usually due to an abort being issued as part of timeout recovery). Remove what amounts to an insufficient KASSERT, and don't overwrite the state value. State should probably be re-designed, and that will be done with a future commit. Reported by: phk, bei.io Reviewed by: imp, mav Differential Revision: D19677 Notes: svn path=/head/; revision=345479
* Fix whitespace from r342528Scott Long2018-12-311-3/+2
| | | | Notes: svn path=/head/; revision=342659
* Update mpr driver version to v23.00.00.00-fbsdKashyap D Desai2018-12-261-1/+1
| | | | | | | | | | | Submitted by: Sreekanth Reddy <sreekanth.reddy@broadcom.com> Reviewed by: Kashyap Desai <Kashyap.Desai@broadcom.com> Approved by: ken MFC after: 3 days Sponsored by: Broadcom Inc Notes: svn path=/head/; revision=342536
* Update copyright informationKashyap D Desai2018-12-2610-12/+22
| | | | | | | | | | | Submitted by: Sreekanth Reddy <sreekanth.reddy@broadcom.com> Reviewed by: Kashyap Desai <Kashyap.Desai@broadcom.com> Approved by: ken MFC after: 3 days Sponsored by: Broadcom Inc Notes: svn path=/head/; revision=342535
* On Aero/Sea A0 cards retry MPT Fusion registers reads for max three timesKashyap D Desai2018-12-261-1/+8
| | | | | | | | | | | | | | | | | Due to HW Errta on Aero/Sea A0 chipset on secure boot mode & on heavy IO load, sometimes read operation on MPT Fusion registers will give zero value, So, as a workaround driver will retry the MPT Fusion register read operation for max three times upon reading zero value form these registers. Submitted by: Sreekanth Reddy <sreekanth.reddy@broadcom.com> Reviewed by: Kashyap Desai <Kashyap.Desai@broadcom.com> Approved by: ken MFC after: 3 days Sponsored by: Broadcom Inc Notes: svn path=/head/; revision=342534
* Enable atomic type descriptor support only for Sea & Aero cardsKashyap D Desai2018-12-261-2/+3
| | | | | | | | | | | | | | | Enable atomic type descriptor support only for Sea & Aero cards, due to HW errata this atomic descriptor support has to be disabled on Ventura cards. Submitted by: Sreekanth Reddy <sreekanth.reddy@broadcom.com> Reviewed by: Kashyap Desai <Kashyap.Desai@broadcom.com> Approved by: ken MFC after: 3 days Sponsored by: Broadcom Inc Notes: svn path=/head/; revision=342533
* Add Sea,Aero adapter supportKashyap D Desai2018-12-262-0/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added deviceID's for Sea,Aero to mpr Driver Aero: 0x00E0 Invalid 0x00E1 Configurable Secure 0x00E2 Hard Secure 0x00E3 Tampered Sea: 0x00E4 Invalid 0x00E5 Configurable Secure 0x00E6 Hard Secure 0x00E7 Tampered For Tampered & Invalid type cards, driver will claim the device & quit the probe function with below error message, "HBA is in Non Secure mode" for Configurable Secure type cards, driver will display below message in .probe() callback function, "HBA is in Configurable Secure mode" Submitted by: Sreekanth Reddy <sreekanth.reddy@broadcom.com> Reviewed by: Kashyap Desai <Kashyap.Desai@broadcom.com> Approved by: ken MFC after: 3 days Sponsored by: Broadcom Inc Notes: svn path=/head/; revision=342531
* Added support for NVMe Task ManagementKashyap D Desai2018-12-265-17/+259
| | | | | | | | | | | | | | | | | | | | Following list of changes done in the driver as a part of TM handling on the NVMe drives. Below changes are only applicable on NVMe drives and only when custom NVMe TM handling bit is set to zero by IOC. 1. Issue LUN reset & Target reset TMs with Target reset method field set to Protocol Level reset (0x3), 2. For LUN & target reset TMs use the timeout value as ControllerResetTO value provided by firmware using PCie Device Page 0, 3. If LUN reset fails to terminates the IO then directly escalate to host reset instead of going for target reset TM, 4. For Abort TM use the timeout value as NVMeAbortTO value given by the IOC using Manufacturing Page 11, 5. Log message "PCie Host Reset failed" message up on receiving P Submitted by: Sreekanth Reddy <sreekanth.reddy@broadcom.com> Reviewed by: Kashyap Desai <Kashyap.Desai@broadcom.com> Approved by: ken MFC after: 3 days Sponsored by: Broadcom Inc Notes: svn path=/head/; revision=342530
* Copy back the Sense data at proper location expected by the applicationKashyap D Desai2018-12-261-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | typedef struct mps_pass_thru { uint64_t PtrRequest; uint64_t PtrReply; uint64_t PtrData; uint32_t RequestSize; uint32_t ReplySize; uint32_t DataSize; uint32_t DataDirection; uint64_t PtrDataOut; uint32_t DataOutSize; uint32_t Timeout; } mps_pass_thru_t, * ptrmpssas_pass_thru_t; In the above mps_pass_thru structure; Application expects PrtReply buffer should contain both MPI reply followed by sense data. So, updated driver to copy sense data at PtrReply + sizeof(MPI2 reply) location where application wants the driver to copy back the sense data info. Submitted by: Sreekanth Reddy <sreekanth.reddy@broadcom.com> Reviewed by: Kashyap Desai <Kashyap.Desai@broadcom.com> Approved by: ken MFC after: 3 days Sponsored by: Broadcom Inc Notes: svn path=/head/; revision=342528
* Update MPI header files version to 2.00.52 from 2.00.48Kashyap D Desai2018-12-2613-512/+264
| | | | | | | | | | | Submitted by: Sreekanth Reddy <sreekanth.reddy@broadcom.com> Reviewed by: Kashyap Desai <Kashyap.Desai@broadcom.com> Approved by: ken MFC after: 3 days Sponsored by: Broadcom Inc Notes: svn path=/head/; revision=342526
* Further refactoring for task management commands. Also fix a relatedScott Long2018-12-241-16/+17
| | | | | | | typo from the previous commit. Notes: svn path=/head/; revision=342388
* Commands for user-initated device resets should come from the high-priorityScott Long2018-12-241-2/+2
| | | | | | | allocator. Prior to this change, they would leak from the normal allocator. Notes: svn path=/head/; revision=342387
* First step in refactoring and fixing the error recovery and task managementScott Long2018-12-243-21/+14
| | | | | | | | code in the mpr and mps drivers. Eliminate duplicated code and fix some comments. Notes: svn path=/head/; revision=342386
* mps(4), mpr(4): remove SATA ID command cancellation hackConrad Meyer2018-12-213-61/+30
| | | | | | | | | | | | | | | | Add a generic mechanism to override mp?_wait_command's timeout behavior, which continues to invoke reinit by default. Invokers who set cm_timeout_handler may avoid automatic reinit and do their own handling. Adapt mp?sas_get_sata_identify to this mechanism and remove its callout hack. Reviewed by: scottl Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D18614 Notes: svn path=/head/; revision=342355
* mps(4), mpr(4): Fix lifetime of command buffer for mp?sas_get_sata_identifyConrad Meyer2018-12-212-6/+12
| | | | | | | | | | | | | | In the event that the ID command timed out, mps(4)/mpr(4) did not free the command until it could be cancelled. However, it freed the associated buffer (cm_data). Fix the lifetime issue by freeing the associated buffer only after Abort Task or controller reset. Reviewed by: scottl Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D18612 Notes: svn path=/head/; revision=342354
* Copy and clear the reply descriptor atomically. This prevents concurrencyScott Long2018-12-091-6/+16
| | | | | | | | in the interrupt handlers (usually due to timeout/error recovery) from seeing and processing the same descriptor twice. Notes: svn path=/head/; revision=341755
* Add PNP info to PCI attachments of cbb, cxgb, ida, iwn, ixl, ixlv,Warner Losh2018-09-261-3/+8
| | | | | | | | | | | | | mfi, mps, mpr, mvs, my, oce, pcn, ral, rl. This only labels existing pci device tables, and has no probe / attach code changes. Reviewed by: imp, chuck Submitted by: Lakhan Shiva Kamireddy <lakhanshiva@gmail.com> Sponsored by: Google, Inc. (GSoC 2018) Approved by: re (glen) Notes: svn path=/head/; revision=338949
* Make NVMe compatible with the original APIChuck Tuffli2018-08-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | The original NVMe API used bit-fields to represent fields in data structures defined by the specification (e.g. the op-code in the command data structure). The implementation targeted x86_64 processors and defined the bit fields for little endian dwords (i.e. 32 bits). This approach does not work as-is for big endian architectures and was changed to use a combination of bit shifts and masks to support PowerPC. Unfortunately, this changed the NVMe API and forces #ifdef's based on the OS revision level in user space code. This change reverts to something that looks like the original API, but it uses bytes instead of bit-fields inside the packed command structure. As a bonus, this works as-is for both big and little endian CPU architectures. Bump __FreeBSD_version to 1200081 due to API change Reviewed by: imp, kbowling, smh, mav Approved by: imp (mentor) Differential Revision: https://reviews.freebsd.org/D16404 Notes: svn path=/head/; revision=338182
* Port the mps panic-safe shutdown_final handling to mprWarner Losh2018-08-132-14/+24
| | | | | | | | | | | | | r330951 by smh fixed the mps driver to avoid deadlocks when panicing. The same code is needed for mpr, so port it here, along with the fix which allows the CCBs scheduled to complete avoiding at least a scary message and likely other unintended consequences. Sponsored by: Netflix Differential Review: https://reviews.freebsd.org/D16663 Notes: svn path=/head/; revision=337725
* Clean enclosure_table when resetting num_enc_table_entries to zero.Alexander Motin2018-05-021-0/+2
| | | | | | | | | | | Garbage left there by r325363 in some scenarios found to lead to later enclosure mapping failures. MFC after: 1 week Sponsored by: iXsystems, Inc. Notes: svn path=/head/; revision=333158
* Move most of the contents of opt_compat.h to opt_global.h.Brooks Davis2018-04-061-2/+0
| | | | | | | | | | | | | | | | | | | | | opt_compat.h is mentioned in nearly 180 files. In-progress network driver compabibility improvements may add over 100 more so this is closer to "just about everywhere" than "only some files" per the guidance in sys/conf/options. Keep COMPAT_LINUX32 in opt_compat.h as it is confined to a subset of sys/compat/linux/*.c. A fake _COMPAT_LINUX option ensure opt_compat.h is created on all architectures. Move COMPAT_LINUXKPI to opt_dontuse.h as it is only used to control the set of compiled files. Reviewed by: kib, cem, jhb, jtl Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D14941 Notes: svn path=/head/; revision=332122
* Disable T10 Protection Information / EEDP handling for type 2 protection.Kenneth D. Merry2018-03-231-4/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The mps(4) and mpr(4) drivers and hardware handle T10 Protection Information, which is a system of checksums and guard blocks to protect data while it is being transferred and while it is on disk. It is also known as T10 DIF. For more details, see section 4.22 of the SBC-4 spec. Supporting Type 2 protection requires using 32 byte CDBs, and filling in the fields in those CDBs. We don't yet support that in the da(4) driver. Type 1 and Type 3 protection don't require that, and can be handled by the mps(4)/mpr(4) driver's code and firmware without any additional input from the da(4) driver. If a drive has Type 2 protection enabled (you frequently see this with SAS drives shipped from Dell), don't set the various EEDP fields in the mps(4)/mpr(4) driver command fields. Otherwise, you wind up with errors like this that would otherwise make no sense: (da9:mpr0:0:18:0): READ(10). CDB: 28 00 00 00 00 00 00 02 00 00 (da9:mpr0:0:18:0): CAM status: SCSI Status Error (da9:mpr0:0:18:0): SCSI status: Check Condition (da9:mpr0:0:18:0): SCSI sense: ILLEGAL REQUEST asc:20,0 (Invalid command operation code) (da9:mpr0:0:18:0): (da9:mpr0:0:18:0): Field Replaceable Unit: 0 (da9:mpr0:0:18:0): Command Specific Info: 0 (da9:mpr0:0:18:0): (da9:mpr0:0:18:0): Descriptor 0x80: f8 21 (da9:mpr0:0:18:0): Descriptor 0x81: 00 00 00 00 00 00 (da9:mpr0:0:18:0): Error 22, Unretryable error In other words, what kind of strange SAS hard drive doesn't support a standard 10 byte SCSI READ command? In this case, one that has Type 2 protection enabled. We can revisit this when we put Type 2 protection support in the da(4) driver, but for now this will help people who put Type 2 formatted drives in a system and wonder what in the world is going on. MFC after: 3 days Sponsored by: Spectra Logic Notes: svn path=/head/; revision=331422
* Update mpr(4) driver from v15 to v18 from Broadcom site.Alexander Motin2018-03-199-37/+148
| | | | | | | | | | | | | | Version 16 is just a number bump, since we already had those changes. Version 17 introduces new AdapterType value, that allows new user-space tools from Broadcom to differentiate adapter generations 3 and 3.5. Version 18 updates headers and adds SAS_DEVICE_DISCOVERY_ERROR reporting. MFC after: 2 weeks Notes: svn path=/head/; revision=331228
* Implement a sysctl to dump in-flight I/O state for debugging. The tool toScott Long2018-03-121-0/+70
| | | | | | | | | parse it will be committed in a separate action. Sponsored by: Netflix Notes: svn path=/head/; revision=330789
* Allow physically non-contiguous chain frames allocation in mps(4)/mpr(4).Alexander Motin2018-02-272-48/+59
| | | | | | | | | | | | | | | | | | | | | Chain frames required to satisfy all 2K of declared I/Os of 128KB each take more then a megabyte of a physical memory, all of which existing code tries allocate as physically contiguous. This patch removes that physical contiguousness requirement, leaving only virtual contiguousness. I was thinking about other ways of allocation, but the less granular allocation becomes, the bigger is the overhead and/or complexity, reaching about 100% overhead if allocate each frame separately. The patch also bumps the chain frames hard limit from 2K to 16K. It is more than enough for the case of default REQ_FRAMES and MAXPHYS (the drivers will allocate less than that automatically), while in case of increased MAXPHYS it will control maximal memory usage. Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D14420 Notes: svn path=/head/; revision=330049
* NVMe: Add big-endian supportWojciech Macek2018-02-221-6/+10
| | | | | | | | | | | | | | | | Remove bitfields from defined structures as they are not portable. Instead use shift and mask macros in the driver and nvmecontrol application. NVMe is now working on powerpc64 host. Submitted by: Michal Stanek <mst@semihalf.com> Obtained from: Semihalf Reviewed by: imp, wma Sponsored by: IBM, QCM Technologies Differential revision: https://reviews.freebsd.org/D13916 Notes: svn path=/head/; revision=329824
* Improve command lifecycle debugging and detection of problems.Scott Long2018-02-183-13/+36
| | | | | | | Sponsored by: Netflix Notes: svn path=/head/; revision=329522